[Openmcl-devel] with-package

Taoufik Dachraoui dachraoui.taoufik at gmail.com
Mon Jan 14 14:38:27 PST 2013


Hi

Sorry but this will be my last message, I want to explain why I wanted to
create this simple package system

basically the intention behind mb system is to behave exactly like the
common lisp package with an exception

when we use (USE-PACKAGE P1) all external symbols of P1 will be imported
into the current package
and if there is a conflict we have to unintern those already existing
package

the idea behind mb is to save those symbols and restore them when we unuse
P1, instead of losing them


example:

? *package*
#<Package "P1">
? (defun foo (x) (1+ x))
FOO
? (in-package :p2)
#<Package "P2">
? (defun foo (x) (+ x 2))
FOO
? (export 'foo)
T
? (in-package :p1)
#<Package "P1">
? (foo 3)
4
? (use-package :p2)
Invoking restart: UNINTERN all conflicting symbols from #<Package "P1">
T
? (foo 3)
5
? (unuse-package :p2)
T
? (foo 3)
Invoking restart: Return to toplevel.


To solve this situation i created mb such that when you unuse p2 the
p1::foo is restored

? (in-package :p1)
? (defun foo (x) (1+ x))
FOO
? (foo 3)
4
? (use :p2)
NIL
? (foo 3)
5
? (unuse :p2)
NIL
? (foo 3)
4


I apologize if I annoyed some people on this board

Kind regards








On Mon, Jan 14, 2013 at 10:12 PM, R. Matthew Emerson <rme at clozure.com>wrote:

> I appreciate that the discussion of this with-package macro and associated
> issues may be generally interesting to a number of people, but it seems to
> me that the discussion is not about CCL in particular, but is instead
> really about Common Lisp generally.
>
> That being so, would it be too much to ask the participants to consider
> moving further discussion of this topic to private mail or some other place?
>
> _______________________________________________
> Openmcl-devel mailing list
> Openmcl-devel at clozure.com
> http://clozure.com/mailman/listinfo/openmcl-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.clozure.com/pipermail/openmcl-devel/attachments/20130114/3e7269c6/attachment.htm>


More information about the Openmcl-devel mailing list