home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / lang / lisp / 3095 < prev    next >
Encoding:
Text File  |  1992-12-16  |  1.8 KB  |  55 lines

  1. Path: sparky!uunet!cis.ohio-state.edu!magnus.acs.ohio-state.edu!usenet.ins.cwru.edu!agate!spool.mu.edu!sdd.hp.com!saimiri.primate.wisc.edu!ames!elroy.jpl.nasa.gov!usc!sol.ctr.columbia.edu!ira.uka.de!rz.uni-karlsruhe.de!ma2s2!haible
  2. From: haible@ma2s2.uucp (Bruno Haible)
  3. Newsgroups: comp.lang.lisp
  4. Subject: Re: eval-when situation question
  5. Date: 16 Dec 1992 16:28:59 GMT
  6. Organization: University of Karlsruhe, Germany
  7. Lines: 41
  8. Sender: <haible@ma2s2.mathematik.uni-karlsruhe.de>
  9. Message-ID: <1gnlgbINN6bs@nz12.rz.uni-karlsruhe.de>
  10. References: <1992Dec15.190606.102345@eratu.rz.uni-konstanz.de>
  11. NNTP-Posting-Host: ma2s2.mathematik.uni-karlsruhe.de
  12. Keywords: eval-when, *readtable*
  13.  
  14. Hi,
  15.  
  16. Joerg asks:
  17. > I've got a file that makes use of a modified *readtable* provided by
  18. > an other file, and I'd like the environment (say *readtable*) not
  19. > altered by the loading (or even compilation) of that file.
  20.  
  21. Use
  22.  
  23.    (eval-when (compile eval)
  24.      (shiftf *original-readtable* *readtable* *special-readtable*)
  25.    )
  26.  
  27. at the beginning and
  28.  
  29.    (eval-when (compile eval)
  30.      (setq *readtable* *original-readtable*)
  31.    )
  32.  
  33. at the end of that file.
  34.  
  35. > Ideally, the reader would expand the ? at read-time, so that the compiler
  36. > wouldn't even see the ?. I believe that the (eval-when (compile) #)
  37. > takes care of this.
  38.  
  39. Exactly that is happening.
  40.  
  41. The "eval" situation accounts for the case where the uncompiled .lisp file
  42. is loaded. The "load" situation is not needed here since it denotes loading
  43. of the compiled .fasl file which of course does not contain the ? any more.
  44.  
  45. > But I'm wondering why CLtLII, p.89 provides a similar example with
  46. > set-macro-character and says to use (eval-when (compile load eval) #),
  47. > not only (compile) as the set of situations.
  48.  
  49. Because it is usual to modify the environment, for example to test the
  50. read macro.
  51.  
  52.       Bruno
  53.       haible@ma2s2.mathematik.uni-karlsruhe.de
  54.  
  55.