axiom-developer
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Axiom-developer] Re: Boot, Virtual Machine


From: Waldek Hebisch
Subject: Re: [Axiom-developer] Re: Boot, Virtual Machine
Date: Wed, 23 May 2007 04:24:01 +0200 (CEST)

Gabriel Dos Reis wrote:
> Stephen Wilson <address@hidden> writes:
> 
> | Greetings all,
> | 
> | Its been a while since I posted to the list, The following has me
> | curious.
> | 
> | Gabriel Dos Reis <address@hidden> writes:
> | 
> | > On Tue, 22 May 2007, address@hidden wrote:
> | > 
> | > | Using Boot means that we lose the macro capability of lisp,
> | > 
> | > No, you don't.  You can define macros at Boot level.  They get 
> | > translated as macros at Lisp level.  It looks to me that most of your
> | > objections stem from insufficient familairity with Boot than informed
> | > assessment. 
> | 
> | Gaby. Could you, please, give an informative example of how Boot
> | macros translate into Lisp?  Perhaps an interesting example of how a
> | Lisp macro could be translated into Boot?  Unfortunately, I do not
> | understand Boot particularly well.  In my readings of the extant Boot
> | code I have not noticed heavy use of macros.  However, I do understand
> | Lisp.
> 
> Hi Stephen,
> 
>    The Boot macro system was there before I got interested in Boot.
> Basically you define Boot macros the same way you define Boot
> functions except that you replace the "==" token with "==>"
> For example, if you can write the memeq macro as:
> 
>    memeq(e,l) ==>
>      MEMBER(a,l, KEYWORD::TEST, function EQ)
> 
> that gets translated as:
> 
> 
>    ; memeq(e,l) ==>
>    ;   MEMBER(e,l, KEYWORD::TEST, function EQ)
> 
>    (DEFMACRO |memeq| (|bfVar#2| |bfVar#1|)
>      (PROG ()
>        (RETURN
>          (SUBLIS (LIST (CONS '|bfVar#2| |bfVar#2|)
>                        (CONS '|bfVar#1| |bfVar#1|))
>                  '(MEMBER |bfVar#2| |bfVar#1| :TEST #'EQ)))))
> 
> 
> At some point, I had a patch to clean up the translation but:
>   (1) there seems to be no use of macros in Boot codes
>   (2) Given (1), it did not seem to be a pressing issue
>   (3) Nobody raised the issue of not knowing how to write macros
>       int Boot.
> 
> Note also that one always have the escape character (!) to 
> insert raw Lisp code if one really wants to.
> 
> Is there any contrived used of macros in Axiom that is not covered by
> the above scheme?
>

One of the simplest macros is SPADCALL, and it already looks beyond
the scheme above.  More interesting example involve optimizing
macros like qeqcar which generate specialized code for constants.
Or pattern maching like setqp.

I think that main point is that macros allows you to easily
perform local code transformations which otherwise require 
changes to the compiler.  Even if you can change compiler
working at one level is easier.


-- 
                              Waldek Hebisch
address@hidden 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]