[BUG] equivalence between strings and symbols
Henrik Gedenryd
Henrik.Gedenryd at lucs.lu.se
Sat Apr 8 07:18:40 UTC 2000
John W. Sarkela wrote:
> Haven't made the change yet. Up to my own devices, I would
> ensure that a string and a symbol are never equivalent.
Am I the only one being confused by this terminology? I would call #=
equality, and save equivalence for #==. Even though the ordinary name for
#== is identity, other languages such as Prolog call this equivalence, vs
equality for #=.
My two cents are that a string and a symbol should be able to be equal, if
not equivalent, because in my view equality/#= typically concerns contents,
not identity. I'm almost sure there are other cases where elements of
different classes (with a common ancestor) answer true for the #= test.
Anyway, this often makes good sense.
Still, I find it very interesting that the asymmetry arises from one class
overriding the other's equality definition. That almost has a philosophical
dimension to it.
> We found other 'strange' behavior with strings and symbols... for example:
> #squeak printString -> 'squeak'
>
> This is sometimes confusing (especially for some of the stuff that we are
> doing). It is also different than in some other Smalltalks. I think that it
> should be:
>
> #squeak printString -> '#squeak'
Well, here I think String>>printString should quote its results too, for
consistency, no? Note that printString gives you the contents, which makes
the former correct, although I agree that this may be confusing. Otherwise,
storeString will do what you need IIRC.
Henrik
More information about the Squeak-dev
mailing list
|