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

RE: macros vs. blocks

SWAP can be trivially written with reference parameters.  I don't know
SETF and ROTATEF.  Are there good examples of macros that cannot be
written with closures and reference parameters?

(I'm not arguing for/against reference parameters;  I'm simply trying to
better understand macros.)


-----Original Message-----
From: Guy Steele - Sun Microsystems Labs [mailto:Guy.Steele@sun.com] 
Sent: Monday, November 18, 2002 8:57 AM
To: ll1-discuss@ai.mit.edu
Cc: tlb@umbrellaresearch.com; Guy.Steele@east.sun.com
Subject: Re: macros vs. blocks

   Date: 18 Nov 2002 14:34:05 -0000
   To: ll1-discuss@ai.mit.edu
   From: Paul Graham <pg@archub.org>
   Subject: macros vs. blocks
   Cc: tlb@umbrellaresearch.com
   If anyone has good examples of macros that *can't* be 
   expressed with a convenient notation for closures, it would
   be interesting to see them.  My Smalltalk-hacking friend
   Trevor Blackwell has often claimed that macros were
   unnecessary if you had blocks, so as long as we're on 
   the subject, please send him (and ll1-discuss) your 

Common Lisp SETF and such related macros as ROTATEF come to mind.

(For this not fluent in Common Lisp: consider the macro SWAP,
which takes two variables and swaps their contents.  This is
hard to do with blocks because part of the point of the macro
is that the programmer writes a single mention of a variable
and it gets used both as an L-value and as an R-value.)