home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / lang / lisp / mcl / 1362 < prev    next >
Encoding:
Text File  |  1992-09-10  |  1.5 KB  |  46 lines

  1. Path: sparky!uunet!cs.utexas.edu!sun-barr!ames!data.nas.nasa.gov!taligent!apple!apple!cambridge.apple.com!kab@cambridge.apple.com
  2. From: kab@cambridge.apple.com (Kim Barrett)
  3. Newsgroups: comp.lang.lisp.mcl
  4. Subject: Re: MCL 2.0 final defsys package screw
  5. Message-ID: <9209102206.AA05660@cambridge.apple.com>
  6. Date: 10 Sep 92 23:09:48 GMT
  7. Sender: info-mcl-request@cambridge.apple.com
  8. Lines: 32
  9. Approved: comp.lang.lisp.mcl@Cambridge.Apple.C0M
  10. Full-Name: Kim Barrett
  11. Original-To: nathan@akbar.teleos.com
  12. Original-Cc: info-mcl%cambridge.apple.com@apple.COM
  13.  
  14. > The offending piece of code is:
  15. > (defun ...
  16. >   (if package
  17. >     (let ((spackage *package*))
  18. >       (unwind-protect
  19. >           (progn (in-package package)
  20. >                  (load path))
  21. >         (in-package (package-name spackage))))
  22. >     (load path))
  23. > ...)
  24. > I assume that the problem has to do with a change in when in-package
  25. > gets evaluated (presumably related to the change between CLtL1 and
  26. > CLtL2) and what it expects to see as its argument.  Packages have
  27. > always seemed a little magical to me, so I was hoping someone would
  28. > tell me whether the following translation would have the correct
  29. > effect:
  30. >   (if package
  31. >     (let ((*package* (find-package package)))
  32. >       (load path))
  33. >     (load path))
  34.  
  35. Yes.  In fact, it should have been written in that fashion to start with.  
  36. (That business of using unwind-protect with in-package is quite yucky).  
  37. Another (to me, clearer) way to write it is
  38.  
  39.   (let ((*package* (if package (find-package package) *package*)))
  40.     (load path))
  41.