[Aldor-l] [Axiom-developer] "has" and "with" (was curious algebra failure)

Ralf Hemmecke ralf at hemmecke.de
Mon Aug 13 07:51:08 EDT 2007


> | Isn't the problem whether 'Monad has SetCategory with "*":(%,%)->%' ?

> If the question is formulated in terms of "has", then I think the answer
> is unambiguously "yes".

Gaby, if you are going to implement "yes", then we should keep in mind 
that the Aldor compiler currently does not allow categories as the first 
argument of "has" and the AUG.pdf p.96 "Has expressions" is clear about 
this.

I must say, I am in favour of relaxing that to allow also categories as 
the first argument. The reason is a conditional export in the definition 
of List in LibAldor.

   l: List(PrimitiveType) := [Integer, String]

should be OK (PrimitiveType is the category that only exports
   =: (%, %) -> %
). But internally List makes conditional tests of the form

List(T:Type): ListType T == add {
   ...
   if T has PrimitiveType then {
     removeAll(t:T, l:%):% == {...}
     ...
   }
}

So giving a category as an argument to the List constructor results in a 
segmentation fault at runtime. The compiler does not catch that case at 
compile time.

In fact, I believe one should be able to distinguish domains from 
categories. Impossible currently with Aldor.

> It seems to me that the compiler asks the question in terms of coercible,
> instead of "has".

Oh, that would surprise me even in SPAD. Where should the "coerce" 
function come from?

Ralf



More information about the Aldor-l mailing list