home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / lang / lisp / mcl / 1616 < prev    next >
Encoding:
Internet Message Format  |  1992-11-18  |  1.9 KB

  1. Path: sparky!uunet!sun-barr!cs.utexas.edu!usc!zaphod.mps.ohio-state.edu!saimiri.primate.wisc.edu!ames!data.nas.nasa.gov!taligent!apple!cambridge.apple.com!cartier@math.uqam.ca
  2. From: cartier@math.uqam.ca (Guillaume Cartier)
  3. Newsgroups: comp.lang.lisp.mcl
  4. Subject: Re: Making a lambda-expr more like a fn
  5. Message-ID: <9211181612.AA10831@mipsmath.math.uqam.ca>
  6. Date: 18 Nov 92 16:12:02 GMT
  7. Sender: info-mcl-request@cambridge.apple.com
  8. Lines: 45
  9. Approved: comp.lang.lisp.mcl@Cambridge.Apple.C0M
  10.  
  11. <---
  12. | While reading the messages about turning lambda expressions
  13. | into functions, it seemed to me that the following might be reasonable...
  14. | (defmacro with-environment ((var) &body body &environment env)
  15. |     `(let ((,var ',env))
  16. |        ,@body))
  17. | In an artificial example..
  18. | (let ((x 0))
  19. |         (with-environment (env)
  20. |                 (setf counter-fn
  21. |                                                                                 (enclose '(lambda () (incf x)) env))))
  22. | However...
  23. | ? (let ((x 'non-nil-environment))
  24. |     (declare (ignore x))
  25. |     (with-environment (var) var))
  26. | #<BOGUS object @ #x5DF871>
  27. | ?
  28. | Does this work in any Lisp?
  29. | Should it?
  30. --->
  31.  
  32. Strange you should ask about that, I was reading about
  33. exactly that subject last night!
  34.  
  35. It is correct that what you're trying to do should not work.
  36. CLtL2 states on top of page 197:
  37.  
  38.   X3J13 voted in March 1989 <117> to specify that macro environment
  39.   objects received with the &environment argument of a macro function
  40.   have only dynamic extent.
  41.  
  42. Guillaume.
  43.  
  44. *********************************************************************
  45. * Guillaume Cartier                 (514) 844-5294 (maison)         *
  46. * L.A.C.I.M.                        (514) 987-4290 (bureau)         *
  47. * Universite du Quebec a Montreal   (514) 987-8477 (telecopieur)    *
  48. * Montreal, Quebec, Canada          cartier@math.uqam.ca (internet) *
  49. *********************************************************************
  50.