[Aldor-l] workaround for: Re: problems with list of domains
Ralf Hemmecke
ralf at hemmecke.de
Tue Oct 31 16:09:18 EST 2006
On 10/31/2006 07:28 AM, Christian Aistleitner wrote:
> Hello,
>
> On Mon, 30 Oct 2006 16:32:55 +0100, Martin Rubey
> <martin.rubey at univie.ac.at> wrote:
>
>> #include "aldor"
>> []$(List PrimitiveType)
>
> your examples (These were good ones!) helped a great deal to give me an
> impression of the reason why the code crashes, which suffices to get a
> nice and clean workaround:
> It's the conditional exports, when List gets evaluated.
Right. To be more precise it can be tracked down to the fact that the
conditional exports say something like
if T has OutputType then ...
If T in "List PrimitiveType" happens to be of Type Category, that causes
problems for "has".
It simply says: List $ LibAldor is *not* appropriate for producing lists
of domains.
This can be considered as a bug in LibAldor.
Now either the bug is in the code or it is in the documentation. The
constructor List accepts any thing of type "Type" as input. If that is
the interface then it should accept "List PrimitiveType". But the
implementation then is wrong, since it uses "if T has OutputType" which
is not proper Aldor if T is not a domain-valued thing (see "Has
Expression" in the AUG Section 7.9).
The documentation should explicitly forbid to put something of type
Category in the argument of List if the implementation is considered to
be OK.
I'd rather prefer to allow lists of domains to be constructed. My
suggestion would be to remove the conditional code or modify the Aldor
User Guide in such away that "A has OutputType" always returns just
false if A is not domain-valued (for example if A == PrimitiveType).
Would be interesting to learn what the Aldor developers say to that problem.
Ralf
More information about the Aldor-l
mailing list