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

Re: MCL 2.0 final defsys package screw



> The offending piece of code is:
> 
> (defun ...
> 
>   (if package
>     (let ((spackage *package*))
>       (unwind-protect
>           (progn (in-package package)
>                  (load path))
>         (in-package (package-name spackage))))
>     (load path))
> 
> ...)
> 
> I assume that the problem has to do with a change in when in-package
> gets evaluated (presumably related to the change between CLtL1 and
> CLtL2) and what it expects to see as its argument.  Packages have
> always seemed a little magical to me, so I was hoping someone would
> tell me whether the following translation would have the correct
> effect:
> 
>   (if package
>     (let ((*package* (find-package package)))
>       (load path))
>     (load path))

Yes.  In fact, it should have been written in that fashion to start with.  
(That business of using unwind-protect with in-package is quite yucky).  
Another (to me, clearer) way to write it is

  (let ((*package* (if package (find-package package) *package*)))
    (load path))