[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Problem with shadow
> >From: Jeff Dalton <jeff@aiai.edinburgh.ac.uk>
> >Date: Mon, 20 Jan 92 12:30:30 GMT
> >To: kcl@CLI.COM
> >Subject: Problem with shadow
> >
> >Starting kcl ...
> >
> >In KCL there is a problem with shadowing. Use-package still signals a
> >name conflict error. This is a bug. Only an explicit import should
> >signal an error for name conflict with a shadowing symbol. (See CLtL
> >II, section 11.5, page 255.)
>
> Well, I am not sure whether this is a bug, but I agree with
> Jeff in that SHADOWing a symbol that is already present in
> the specified package should be put into the package-
> shadowing-list. To do this, replace the definition of
> "shadow" in file c/package.d with the following code.
I agree that it's not necessarily a bug according to CLtL. But the
action of SHADOW in this case has been "clarified" in the second
edition, which indicates that it's probably a good idea to make the
change.
> Also, USE-PACKAGE must be modified. The current USE-
> PACKAGE signals an error if there is a symbol that is
> present in the USEing package and that has the same name
> as an external symbol in the USEd package.
I thought it should signal an error in that case. That is, I think
the following behavior is correct:
AKCL (Austin Kyoto Common Lisp) Version(1.505) Thu Jan 3 22:19:53 GMT 1991
Contains Enhancements by W. Schelter
>(in-package 'a)
#<"A" package>
A>(export 'aa) ; export AA from package A
t
A>(in-package 'b)
#<"B" package>
B>'aa ; make B::AA present in package B
aa
B>(use-package 'a)
Error: Cannot use #<"A" package>
from #<"B" package>,
because A:AA and AA will cause
a name conflict.
Error signalled by USE-PACKAGE.
The actual change in the code seems to be to add code that checks
the shadowing symbols list of the USEing package:
> y = find_symbol(l->c.c_car, p);
> if (intern_flag && l->c.c_car != y
> && !member_eq(y, p->p.p_shadowings))
> FEerror("Cannot use ~S~%\
> from ~S,~%\
> because ~S and ~S will cause~%\
> a name conflict.", 4, x, p, l->c.c_car, y);
> }
So I am confused.
-- jeff