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

Re: in-package problems



>Hello,
>	I am having some problems with the IN-PACKAGE 
>macro in MCL2.0b1.  IN the old version (Mac. Allegro 
>1.3.2) is is simple to use IN-PACKAGE with a variable 
>name, however this appears no longer to be possible.
>
>For example
>
>(setf *name* Rpackage-nameS)
>(make-package *name*)  ;; this bit works fine
>
>(in-package *name*)
>
>;;;this then returns
>
>> Error: There is no package named "*NAME*" .
>> While executing: CCL::SET-PACKAGE
>
>Am I doing something silly, if not how can I get around 
>this problem and pass package names as variable?
>Thanks for any help
>Tom Usherwood

In CLtL2, an incompatible change was done to IN-PACKAGE. It was a function
and is now a macro that DOES NOT evaluate the argument passed to it.

The simple way to solve your problem is (EVAL `(IN-PACKAGE ,*NAME*))
but is not very elegant.

The other solution is to do the work of the IN-PACKAGE macro yourself,
i.e. something like

(LET ((PCKG (FIND-PACKAGE *NAME*)))
  ;; the test is important, as setting *PACKAGE* to nil will crash MCL
  (WHEN PCKG
    (SETF *PACKAGE* PCKG)))

Guillaume Cartier
LACIM, Universite du Quebec a Montreal.
Bureau: (514) 987-4290
E-Mail: cartier@math.uqam.ca