[eclipse-clp-users] Questions about ECR

From: Ulrich Scholz <Ulrich.Scholz_at_eml-d.villa-bosch.de>
Date: Tue, 27 Jan 2009 10:26:29 +0100
Hello Kish and all,

I have some questions and comments regarding the ECH library.

- The chr/1 predicate allows to clear out old CHR code before compiling new
  ones.  In ECH, this predicate looks really awkward because the argument
  has to be a file and is not really used.  In particular, the file is not
  compiled as in CHR.  I'd be happy if a new version of the library could
  provide a more intuitive predicate.

- Another question about chr/1 and ECH: Some time ago, this list gave me the
  following advice on how to remove old ECLiPSe code.  At those times, I did
  not use CHR or ECH.

    % [...] turn your file into a module, i.e., add a :- module(mymodule).
    % directive to it.  Then the module will be automatically erased before
    % every recompilation.  If you don't want to bother learning about
    % modules, you can choose 'eclipse' as the module name, then you should
    % see no further difference in behaviour.

  That trick doesn't seem to work in combination with chr/1 in ECH: There is
  an error on compiling the second time, see below.  So, what is the best
  way to erase the old clauses and to erase the CHR store?

Thank you,


:- module(eclipse).

:- lib(ech).

% to clean out the constraint store
:- chr(empty).

:- handler typemodule.

% CHR constraints
:- constraints typeSameset/2.


This is an empty file, i.e., a file with zero bytes length.

[scholzuh_at_emld-desktop:ECH] >eclipse
ECLiPSe Constraint Logic Programming System [kernel]
Kernel and basic libraries copyright Cisco Systems, Inc.
and subject to the Cisco-style Mozilla Public Licence 1.1
(see legal/cmpl.txt or www.eclipse-clp.org/licence)
Source available at www.sourceforge.org/projects/eclipse-clp
GMP library copyright Free Software Foundation, see legal/lgpl.txt
For other libraries see their individual copyright notices
Version 6.0 #42 (i386_linux), Wed Sep 24 01:37 2008
[eclipse 1]: [test].
source_processor.eco loaded in 0.01 seconds
hash.eco   loaded in 0.00 seconds
compiler_common.eco loaded in 0.03 seconds
compiler_normalise.eco loaded in 0.02 seconds
compiler_map.eco loaded in 0.01 seconds
compiler_analysis.eco loaded in 0.02 seconds
compiler_peephole.eco loaded in 0.03 seconds
compiler_codegen.eco loaded in 0.04 seconds
compiler_varclass.eco loaded in 0.02 seconds
compiler_indexing.eco loaded in 0.01 seconds
compiler_regassign.eco loaded in 0.02 seconds
asm.eco    loaded in 0.05 seconds
module_options.eco loaded in 0.00 seconds
ecl_compiler.eco loaded in 0.28 seconds
lists.eco  loaded in 0.01 seconds
numbervars.eco loaded in 0.01 seconds
ech.eco    loaded in 0.07 seconds
empty.ecl  compiled 0 bytes in 0.00 seconds
Found CHR typeSameset/2 in module eclipse, generating transformed code
test.ecl   compiled 0 bytes in 0.09 seconds

Yes (0.38s cpu)
[eclipse 2]: -1.
record does not exist in abolish_record_body('CHRcode', eclipse)
ERROR: test.ecl:3:
  Query exited (abort): :- chr(empty)
Error(s) occurred while compiling /home/scholzuh/Forschung/Invarianten/ECH/test.ecl
Aborting execution ...
[eclipse 3]:
Received on Tue Jan 27 2009 - 09:26:09 CET

This archive was generated by hypermail 2.2.0 : Thu Feb 02 2012 - 02:31:58 CET