Information Technology Reference
In-Depth Information
a C++ class library. Thanks to the class encapsulation mechanism and the op-
erator overloading capability of C++, the user can see constraints almost as if
they were a part of the language. A similar approach was independently taken
in the NeMo+ programming environment of [18].
In our approach constraints are integrated into the imperative programming
paradigm, as \rst class citizens" of the language. The interaction between the
constraint store and the program becomes then more transparent and concep-
tually simpler and the resulting constraint programs are in our opinion more
natural than their counterparts written in the constraint logic programming
style or in the imperative languages augmented with constraint libraries.
The reason for this in the case of constraint logic programming is that many
uses of recursion and lists can be replaced by the more basic concepts of bounded
iteration and arrays. In the case of the imperative languages with constraint li-
braries, due to the absence of non-determinism in the language, failure situations
(arising due to inconsistent constraints) must be dealt with explicitly by the pro-
grammer, whereas in
Alma-0
they are managed implicitly by the backtracking
mechanism.
When adding constraints to a strongly typed imperative programming lan-
guage one needs to resolve a number of issues. First, constraints employ variables
in the mathematical sense of the word (so unknowns ) while the imperative pro-
gramming paradigm is based on the computer science concept of a variable, so a
known , but varying entity. We wish to separate between these two uses of vari-
ables because we want to manipulate unknowns only by means of constraints
imposed on them. This precludes the modelling of unknowns by means of unini-
tialized variables since the latter can be modied by means of an assignment.
Second, one needs to integrate the constraints in such a way that various
features of the underlying language such as use of local and global declarations
and of various parameter passing mechanisms retain their coherence.
Additionally, one has to maintain the strong typing discipline according to
which each variable has a type associated with it in such a way that throughout
the program execution only values from its type can be assigned to the variable.
Finally, one needs to provide an adequate support for search, one of the main
aspects of constraint programming.
So the situation is quite dierent than in the case of the logic programming
framework. Namely, the logic programming paradigm is based on the notion
of a variable in the mathematical sense (usually called in this context a logical
variable). This greatly facilitates the addition of constraints and partly explains
why the integration of constraints into logic programming such as in the case
of CHIP (see [19]), Prolog III (see [4]) and CLP(
) (see [11]), to name just
three examples, has been so smooth and elegant. Further, logic programming
languages provide support for automatic backtracking.
However, as already mentioned, in constraint logic programming languages
types are not available. Moreover, there is a very limited support for scoping
and only one parameter mechanism is available.
R
 
Search WWH ::




Custom Search