Next: The Implementation of Monomials
Up: Polymorphism by Virtual Domains
Previous: Coercion Units
The mapping by renaming of functions as explained in the previous sections can
only work properly if each function carries a tag that identifies, for which domain of arguments the function can be
applied. This mechanism is similar to the package principle in
LISP, except that tagging does not happen
automatically but must be done by the programmer. We call it therefore the
Simulated Package Principle (SPP).
The name of the tag corresponds to the data type up to capitalization.
(Syntactically, we append an abbreviation of the domain name as tag, separated
by the underscore character ``_'').
By this mechanism we keep the domain independent of all its subdomains.
Summarizing, the advantages of this independence are that
- we avoid unnecessary duplication of code,
- it is very easy to change from one implementation of a domain
to another one, and
- the system can very easily be extended by new implementations for
already existing domains, because the only thing necessary is to supply a
coercion unit for the new implementation and make this active.
The last point is particularly important if the changes are supposed to be
made on a very low level in a hierarchy of domains (in
our case, for instance, the domain of power products), because without SPP
every change would have to be propagated until to the top of the
hierarchy.
windsteiger wolfgang
Thu Sep 3 14:50:07 MDT 1998