Consider the following (using GCL V 2.2)
(make-package :a :use '(:lisp))
(make-package :b :use '(:lisp))
(intern "X" :a)
(intern "X" :b)
(in-package :a)
(export 'x)
(in-package :b)
(export 'x)
(in-package :user)
(make-package :c :use '(:lisp :a :b))
Now, shouldn't this signal some sort of inconstency, since package C
inherits X from both A and B?
but when I try:
(in-package :c)
(lisp:describe 'x)
I get something like: "X is an external symbol in A".
Well, that is true, but it is not the whole truth!
What are the rules here? CLTL2 is not specific; does the ANSI
standard help? I am implementing a small Common-Lisp subset
in C; want to get the package system right! It will be more
complete than XLISP, *much* smaller than GCL, while using some
good ideas from both.
Thank You,
Jeff Lipton
--
+----------------------------------------------------------------------------+
| Jeffrey F. Lipton, M.D. (ยทยทยท@panix.com) | (212)-663-9333 (home) |
| 8 W. 95th St., #3 NY, NY 10025 | Fundamentalist: One with whom |
+-WWW: http://www.panix.com/~jfl -----there is something fundamentally wrong.|
From: Bill St.Clair
Subject: Re: Question about Package Consistency Rules
Date:
Message-ID: <326A2A4C.3A2D@digitool.com>
Jeff Lipton wrote:
> =
> Consider the following (using GCL V 2.2)
> =
> (make-package :a :use '(:lisp))
> (make-package :b :use '(:lisp))
> (intern "X" :a)
> (intern "X" :b)
> (in-package :a)
> (export 'x)
> (in-package :b)
> (export 'x)
> (in-package :user)
> (make-package :c :use '(:lisp :a :b))
> =
> Now, shouldn't this signal some sort of inconstency, since package C
> inherits X from both A and B?
You are correct that it is an inconsistency. The (make-package :c ...)
form should signal an error. In MCL 4.0, after changing the :lisp
package names to :cl, it does:
? =
> Error: Using #<Package "B"> in #<Package "C"> =
> would cause name conflicts with symbols inherited by that packag=
e: =
> A:X B:X
> =
> While executing: CCL::USE-PACKAGE-1
> Type Command-/ to continue, Command-. to abort.
> If continued: Try again to use #<Package "B"> in #<Package "C">
See the Restarts=85 menu item for further choices.
1 >