home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / lang / lisp / 2120 < prev    next >
Encoding:
Internet Message Format  |  1992-07-27  |  1.6 KB

  1. Path: sparky!uunet!elroy.jpl.nasa.gov!ames!think.com!barmar
  2. From: barmar@think.com (Barry Margolin)
  3. Newsgroups: comp.lang.lisp
  4. Subject: Re: local macro definitions
  5. Date: 27 Jul 1992 19:22:39 GMT
  6. Organization: Thinking Machines Corporation, Cambridge MA, USA
  7. Lines: 29
  8. Distribution: comp.lang.lisp
  9. Message-ID: <151idvINN6mn@early-bird.think.com>
  10. References: <4133@inca.comlab.ox.ac.uk>
  11. NNTP-Posting-Host: telecaster.think.com
  12.  
  13. In article <4133@inca.comlab.ox.ac.uk> gordon@robots.oxford.ac.uk (Gordon Buxton) writes:
  14. >3. Bind each of the slot names to a macro (macrolet ... ?) that then
  15. >gets expanded to (val self '<slot-name>) upon execution.
  16.  
  17. If I understand you, this seems like the right thing.  The name of the
  18. special form is SYMBOL-MACROLET, and it was invented for use by CLOS for
  19. pretty much the same thing you're doing with your frames (e.g.
  20. WITH-ACCESSORS and WITH-SLOTS expand into SYMBOL-MACROLET forms).
  21.  
  22. >-- This is the one I like best, but there are two problems:
  23. >   a) The user-code function call is already constructed using the
  24. >      backquote - I'd have to expand macros within this.
  25.  
  26. This shouldn't be necessary.  It's hard to say for sure, but the right
  27. macro and symbol-macro expansions should all occur automatically.
  28.  
  29. >   b) I don't know how to do it, or if it is possible
  30.  
  31. (symbol-macrolet ((<slot-1> (val self '<slot-1>))
  32.           (<slot-2> (val self '<slot-2>))
  33.           ...)
  34.   <code that references <slot-N> as variables>)
  35.  
  36. See CLtL2 for more details.
  37. -- 
  38. Barry Margolin
  39. System Manager, Thinking Machines Corp.
  40.  
  41. barmar@think.com          {uunet,harvard}!think!barmar
  42.