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: Gabriel Dos Reis
Subject: Re: [Axiom-developer] Re: Boot, Virtual Machine
Date: Tue, 22 May 2007 22:52:19 -0500 (CDT)

On Wed, 23 May 2007, Waldek Hebisch wrote:

| 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,

I doubt SPADCALL is simpler than the MEMEQ macro.

| and it already looks beyond the scheme above.

Which part of it?  Optional arguments?
For optional arguments in Boot, you prepend  a colong to the name of the
variable. 

| More interesting example involve optimizing
| macros like qeqcar which generate specialized code for constants.
| Or pattern maching like setqp.

That does not need speciaal handling in the compiler.

| 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.

You seem to imply that I was proposing to ditch macros.  I'm not.
I'm just pointing out that macros were not kept out of Boot.  They are 
there for those who think they need them.  So, I don't think I would put
special optimization in the compiler.  When I said "clean up", it is in
term of the readability.

-- Gaby




reply via email to

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