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

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

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

--Guy