Thanks for doing the tests Ralf. The results do not suprise me, so I guess my memory is OK is this regard.
Ralf Hemmecke <[EMAIL PROTECTED]> writes: [...] > It is more interesting to ask what happens in an interactive > environment. So let's try. > > woodpecker:~/scratch>aldor -gloop > AA L DDDD OOO RRRR > A A L D D O O R R > A A L D D O O R R > AAAAA L D D O O RRRR > A A L D D O O R R > A A LLLLL DDDD OOO R R > > (c) Numerical Algorithms Group Ltd 1995-2001 > Release: Aldor(C) version 1.0.3 for LINUX(glibc2.3) (debug version) > Type "#int help" for more details. > %1 >> #include "aldor" > %2 >> #include "aldorinterp" > %3 >> #library AAA "aaa.ao" > %4 >> import from AAA; > %5 >> foo()$Foo(Integer) > F @ Boolean > %6 >> #include "algebra" > %7 >> foo()$Foo(Integer) > T @ Boolean > > You cannot even say that this is wrong or right. Foo(Integer) appears > in a "type context" and according to the Aldor specification, it might > or might not be evaluated. I would say the above is `right'. Though the Aldor spec does leaves this unspecified, I would not doubt a specification is possible. I would think it to be desierable if the feature were to be included in SPAD. One basic rule would be that a domain `functor' memoizes its arguments, and always returns the same object for equal arguments, performing any required initialization on the first call. Of course equality is an issue in and of itself, but (for the purpos of functor memoization) my feeling is that Integer should not be equal to 'extend Integer ...' except when the extension is empty. Furthere, no extended domain D would be equal to any other extension of D, similarly for extensions of extensions, etc. As an aside, I feel that runtime equality checks on values (domain elements) should be permited only for those domains which implement BasicType (in which case I would support making BasicType a primitive language defined category). Another option being to use whatever export '=: (%, %) -> Boolean' the domain admits, or perhaps the equivalent Aldor `generic tie-in' which I think is `test'. I strongly feel that SPAD should define precise semantics for any notion of equality used by the compiler. > > I always thought Aldor's `extend' was designed to allow for the > > enrichment of domains defined within a closed-source library, not as a > > general mechanism for solving the kind of mutually recursive > > definitions found in Axioms algebra. > > I must say, even in an open-source environment, "extend" allows you to > introduce layers of your library and thus allows to put more structure > in the design. > > One doesn't have to recompile the whole Axiom library if one thinks > that Integer misses some function. That new function is completely > irrelevant to existing parts of the library and only plays a role in > newer parts. "extend" in my eyes helps to keep libraries maintainable. This is exactly how I used `extend' myself. For resursive definitions I simply placed them all within the same compilation unit. Thanks, Steve _______________________________________________ Axiom-developer mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/axiom-developer
