On Monday, October 16, 2006 7:30 PM Gabriel Dos Reis wrote: Consider the following code snipet:: fricas (1) -> <spad> fricas )abbrev domain T T fricas Compiling FriCAS source code from file /var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/9110329210505148464-25px001.spad using old system compiler. The SPAD compiler complains on the definition of decl with the message [click on + to expand compiler output] On Mon, 16 Oct 2006, Page, Bill wrote: Why would you consider the type T itself to be known in the scope where the value of Decl is computed? Gaby's Reply: Because inside the definition of T(), % is supposed to refer to the domain defined, i.e. T. Yes that is correct. But you are asking SPAD explicitly to evaluate
Gaby said: Notice that the only thing that is needed to be known is the type name. I think it is instructive to see what Aldor says about this construction: Decl := Record(name: Symbol, type: T) ^ [L4 C1] #7 (Error) `Decl' is used in a type, so must be constant, and so cannot be assigned to. After correcting the definition, Aldor compiles this thing without complaint: aldor #pile #include "axiom" aldor Compiling FriCAS source code from file /var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/1501044709281826201-25px002.as using Aldor compiler and options -O -Fasy -Fao -Flsp -lfricas -Mno-ALDOR_W_WillObsolete -DFriCAS -Y $FRICAS/algebra -I $FRICAS/algebra Use the system command )set compiler args to change these options. "/var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/1501044709281826201-25px002.as", Even more exciting is the fact that using the spad )lisp (setq |$bootStrapMode| t) )abbrev domain T T spad Compiling FriCAS source code from file /var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/575440422302135301-25px003.spad using old system compiler. Your user access level is compiler and this command is therefore not available. See the )set userlevel command for more information. The same code which gives the above error: >> System error: Caught fatal error [memory may be damaged] works when compiled in a clean Axiom session. See SandBoxBootStrap2. I wonder why Bill Page wrote: Perhaps you meant to write: Decl := Record(name: Symbol, type: %) Gaby asked: what would that % refers to? As far as I know, in SPAD the Type % is not resolved statically at compile time instead it remains a placeholder for "this domain" in whatever context it occurs. (In contrast to Aldor.) Bill Page claimed: which seems to compile as expected? Gaby: But, we don't know the compiler is right. Which is I'm asking. I don't know. Maybe you need to extend your example to actually do some computation which tests the semantics and/or take a look at the generated Lisp code. |