[Openmcl-devel] with-package

Pascal J. Bourguignon pjb at informatimago.com
Sun Jan 13 12:54:54 PST 2013


Taoufik Dachraoui <dachraoui.taoufik at gmail.com> writes:

> The solution is to not unintern symbols, instead I use a function
> %set-symbol as follows:
>
> (defun %set-symbol (s1 s2)
>   (setf (symbol-plist s1) (symbol-plist s2))
>   (if (boundp s2)
>       (setf (symbol-value s1) (symbol-value s2))
>       (makunbound s1))
>   (if (fboundp s2)
>       (if (null (macro-function s2))
>           (setf (symbol-function s1) (symbol-function s2))
>           (setf (macro-function s1) (macro-function s2)))
>       (fmakunbound s1)))
>
> Check the function %import to see when %set-symbol is called.
>
> This way the imported symbol from calculus will bound/fbound the
> symbol created by the reader

Then the following will fail:

    (defvar *fun*)

    (with-package (calculus)
       (setf *fun* 'share))

    (funcall *fun*)


-- 
__Pascal Bourguignon__                     http://www.informatimago.com/
A bad day in () is better than a good day in {}.




More information about the Openmcl-devel mailing list