I'm sure that this is a "special case" senario, but recently with the
BNF parser I wrote, one of the (common) pitfalls I came across was
calling one of my functions (in package A) from a different package
(B). And of course, EQ will fail...
(eq 'a::foo 'b::boo) => NIL
However, when typing up an example program for a friend recently, I
ended up using TYPECASE in there, and it hit me "wouldn't this fail
given the proper context that it was used in?
Well, this morning I came in, launched LispWorks and did:
(eq 'a::fixnum 'b::fixnum) => T
What the? Special... case... needs... clarification... ;)
Thanks!
Jeff M.
PS. checking to see if this is in Peter's or Graham's books anywhere
"Jeff M." <·······@gmail.com> writes:
> I'm sure that this is a "special case" senario, but recently with the
> BNF parser I wrote, one of the (common) pitfalls I came across was
> calling one of my functions (in package A) from a different package
> (B). And of course, EQ will fail...
>
> (eq 'a::foo 'b::boo) => NIL
>
> However, when typing up an example program for a friend recently, I
> ended up using TYPECASE in there, and it hit me "wouldn't this fail
> given the proper context that it was used in?
>
> Well, this morning I came in, launched LispWorks and did:
>
> (eq 'a::fixnum 'b::fixnum) => T
>
> What the? Special... case... needs... clarification... ;)
FIXNUM is being imported from the CL package by A and by B; hence it
is the same symbol. (eq 'a::fixnum 'cl:fixnum) and
(eq 'b::fixnum 'cl:fixnum).
--
;; Matthew Danish -- user: mrd domain: cmu.edu
;; OpenPGP public key: C24B6010 on keyring.debian.org
Jeff M. wrote:
> I'm sure that this is a "special case" senario, but recently with the
> BNF parser I wrote, one of the (common) pitfalls I came across was
> calling one of my functions (in package A) from a different package
> (B). And of course, EQ will fail...
>
> (eq 'a::foo 'b::boo) => NIL
>
> However, when typing up an example program for a friend recently, I
> ended up using TYPECASE in there, and it hit me "wouldn't this fail
> given the proper context that it was used in?
>
> Well, this morning I came in, launched LispWorks and did:
>
> (eq 'a::fixnum 'b::fixnum) => T
>
> What the? Special... case... needs... clarification... ;)
>
No special case here, I suspect.
The fixnum symbol is external to the common-lisp package, so if both
packages use it then it'll be the same symbol - thus, eq.
Jeff M. wrote:
> I'm sure that this is a "special case" senario, but recently with the
> BNF parser I wrote, one of the (common) pitfalls I came across was
> calling one of my functions (in package A) from a different package
> (B). And of course, EQ will fail...
>
> (eq 'a::foo 'b::boo) => NIL
>
By the way, I know that you're just experimenting above, but you
shouldn't get in the habit of using symbols such as A::FOO, right? The
double colon indicates that FOO is internal to package A and thus
'private'. If FOO has been exported, and you can access it as A:FOO,
then you're all right.
David Sletten