Next: The ALLCOT syntax
Up: The ALLCOT language
Previous: An ALLCOT program
Strictly speaking, the ALDOR language is not
an object oriented language.
Indeed, its notion of a domain is richer
than a class (like a JAVA class).
However, the ALLCOT language, because of its
restrictions w.r.t. ALDOR, will essentially be
a simple object oriented language.
In the above example OddNumbers and Word
are classes in the sense that
- the values of these types are encoded by means of attributes
that are not visible outside of the class,
- each function of these types is morally either a method
(that is, a function whose first argument is of the type
where the function is defined)
or a creator
(that is, a function which returns a value of the type where
the function is defined).
In the above example, Monoid, WordMonoid and
MonoidOfZ are interfaces in the sense that
each of them is a list of function declarations.
Note that both WordMonoid and MonoidOfZ
inherit from Monoid.
Observe also that
- on the contrary of JAVA, creators like one,
convert or word are allowed in a category,
- the syntax of an ALLCOT function declaration is rather
that of PASCAL than that of C or JAVA.
Observe also the role of the symbol %.
- In one of the categories Monoid, WordMonoid or
MonoidOfZ, this symbol means an element
of a domain implementing this category.
- In one of the domains OddNumbers and Word,
this symbol means an element of this domain.
Finally, observe the different kinds of equality-like symbols.
- ==
- is used for a category definition, a domain definition
or a function definition. In fact, in aldor
it is used for a constant definition, that is for
the definition of some variable whose value cannot
change.
- :=
- is used for a variable definition (whose value
can change).
- =
- is used for the equality test.
Next: The ALLCOT syntax
Up: The ALLCOT language
Previous: An ALLCOT program
Marc Moreno Maza
2004-12-01