[Ecls-list] Weird behavior with package variable named "STRING"

Marco Antoniotti marcoxa at cs.nyu.edu
Thu Dec 1 09:44:04 UTC 2005


On Dec 1, 2005, at 10:15 AM, Goffioul Michael wrote:

> Here's a piece of ECL session:
>
>> (defpackage "A")
> #<"A" package>
>> (defpackage "B")
> #<"B" package>
>> (defvar a::string 261)
> STRING
>> (defvar b::string 262)
> STRING
>> a::string
> 261
>> b::string
> 261
>
> As you can see, the "STRING" variable in package "B" has not the
> expected value. Is this normal? This does not happen with another
> variable name (I tried with "num" instead of "string").

Try the following

(defpackage "A" (:use))
(defpackage "B" (:use))

(defvar a::string 261)
(defvar b::string 262)

You will see that it works.

In your case, most likely you are bumping in the default "package use 
list" of ECL.  STRING is a symbol in the CL package, so (AND (EQ 
'A::STRING CL:STRING) (EQ 'B::STRING 'CL:STRING)) is true.

Cheers



--
Marco Antoniotti					http://bioinformatics.nyu.edu/~marcoxa
NYU Courant Bioinformatics Group		tel. +1 - 212 - 998 3488
715 Broadway 10th FL				fax. +1 - 212 - 998 3484
New York, NY, 10003, U.S.A.





More information about the ecl-devel mailing list