On Thu, Apr 2, 2009 at 2:19 PM, Gabriel Dos Reis <g...@cs.tamu.edu> wrote: > Bill Page writes: > > | Since BinarySearchTree is a particular class of BinaryTree for > | consistency in BinarySearchTree I would expect to see: > | > | Implementation == BinaryTree(S) add > | Rep == List Tree S > > As I said, I would not. I would not expect any definition of Rep > at all. The domain extension says BinaryTree(S) is the Rep of > BinarySearchTree(S). >
Sorry, then this is my confusion. As I said, I expected that the Rep of BinarySearchTree should be the same as the Rep of the domain from which it inherits - *not* the domain itself. My (perhaps poor) understanding of add-inheritance NewDomain(): with ... exports ... == OldDomain add ... body ... was that all functions and constants defined in the OldDomain (regardless of whether they are exported or not) are visible to code in the body of the new domain. Is that true or not? In the Axiom Book it says: 13.8 Add Domain ... The Implementation part of a definition can optionally specify an “add- domain” to the left of an add (for QuadraticForm, defines SquareMatrix(n,K) is the add-domain). The meaning of an add-domain is simply this: if the cap- sule part of the Implementation does not supply a function for an operation, Axiom goes to the add-domain to find the function. --- Perhaps it is not so clear what "Axiom goes to the add-domain to find the function" means. In clifford.spad.pamphlet I see: SM ==> SquareMatrix ... Impl ==> SM(n,K) add Rep := SM(n,K) which obviously corresponds to your interpretation, Gaby. There are numerous other examples of this in the library. But in 'xlpoly.spad.pamphlet' I see: LiePolynomial(VarSet:OrderedSet, R:CommutativeRing) : Public == Private where ... Private == FreeModule1(R, LWORD) add import(TERM) --representation Rep := List TERM and in 'xpoly.spad.pamphlet' we have: FreeModule1(R:Ring,S:OrderedSet): FMcat == FMdef where ... FMdef == FreeModule(R,S) add -- representation Rep := List TERM and in 'poly.spad.pamphlet': FreeModule(R:Ring,S:OrderedSet): Join(BiModule(R,R),IndexedDirectProductCategory(R,S)) with if R has CommutativeRing then Module(R) == IndexedDirectProductAbelianGroup(R,S) add --representations Term:= Record(k:S,c:R) Rep:= List Term ... which looks more like what I expected to find. > | Note: The 2nd line above is not required in OpenAxiom. > > And I think that is a coherent, simple notation for a simple semantics. > If were true that functions local to OldDomain are available in NewDomain and if the Rep in NewDomain is just OldDomain then I would be worried about how to correctly call these functions. Regards, Bill Page. ------------------------------------------------------------------------------ _______________________________________________ open-axiom-devel mailing list open-axiom-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/open-axiom-devel