Node:CHR Backward Compatibility, Previous:CHR Constraint Handlers, Up:CHR
In this section, we discuss backward compatibility with the CHR library of Eclipse Prolog.
option(rule_ordering,heuristic). option(revive_scheme,old).
already_in_store
,
already_in_head
and guard_bindings
options
are still around, but there are CHR syntax extensions (see CHR Syntax)
and pragmas (see CHR Pragmas)
offering better grained control.
label_with
declaration. Since it was not widely used
and can be easily simulated, built-in labeling was dropped.
The same effect can be achieved
by replacing the declaration label_with Constraint
if Guard
by the simplification rule chr_labeling, Constraint <=>
Guard | Constraint', chr_labeling
and by renaming the head in each
clause Constraint :- Body
into Constraint' :- Body
where
Constraint'
is a new predicate. Efficiency can be improved by
declaring Constraint
to be passive: chr_labeling,
Constraint#Id <=> Guard | Constraint', chr_labeling pragma passive(Id)
.
This translation will not work if option(already_in_heads,on)
.
In that case use e.g. chr_labeling(_), Constraint <=> Guard |
Constraint', chr_labeling(_)
to make the new call to
chr_labeling
differ from the head occurrence.