[Aldor-l] Collapse of function signatures
Christian Aistleitner
tmgisi at gmx.at
Mon Jan 3 08:55:24 EST 2005
Hi Ralf,
> In DistributedMultivariatePolynomial1(R, V, E) there are two functions
> *: (Integer, %) -> %
> *: (R, %) -> %
> The first is implemented in sm_dmp1.as and the second in sm_dmp0.as.
> Fortunately, they do not contradict.
I am not completely sure, what problem you are addressing.
Making axioms of functions more explicit or disambiguation of functions
with same signature in a single domain.
I am not sure, if it is a good choice to call for axioms to be handled
within the Aldor language. I have the feeling, that introducing axioms
will ruin the benefit of compile time checks.
One can model axioms by introducing categories and stating axioms in the
documentation. Thereby the axioms are applied by using the proper
categories (e.g. Group vs. AbelianGroup). Of course, this leads to a vast
amoung of categories, but brings compile time axioms.
Trying to explicitely add axioms to function calls or domains would result
in additional checks. Lets take for example AbelianGroup. How could one
possibly formulate the need for the group to be abelian -- possibly at
compile time?
On the other hand, if you are really talking about disambiguation of
function with same signature in a single domain, then I would say, that
this concerns only the design of a library.
I cannot imagine a case, where a proper designed library would come to the
point, where two functions with the same signature may occur in the same
domain with different meanings.
Therefore it is not sheer luck that for
DistributedMultivariatePolynomial1, no problem arises (in terms of the
functions' semantics), but (hopefully) a design consideration.
Do you have an example at hand?
> Could the compiler at least warn if there is an _obvious_ collapse of
> two function signatures, like with Integer or MachineInteger?
This is likely to give a whole lot of warnings :)
Consider why you want to be warned. I suppose, because a functions
definition hides another functions definition. Now look for example at
SmallPrimeFieldCategory.
It inherits from SmallPrimeFieldCategory0 and PrimeFieldCategory.
These two both inherit from PrimeFieldCategory0.
So every single function from PrimeFieldCategory0 would occur at least
twice. As a result you would get a warning about every single function
from PrimeFieldCategory0.
I would not consider that to be too useful.
Or do I miss anything?
Best regards,
Christian
More information about the Aldor-l
mailing list