No, String is NOT a special case in the ANSI standard, which is what I was specifically writing about. WideString is not in the standard, thank goodness (although at the time the standard was made, it was already clear that at least 16-bit characters were needed). The ANSI rule perfectly fits the semantics of all the ANSI classes and it only applies to sequences defined in the standard, as I thought was clear. It doesn’t apply to numbers, for example. Other than the coherence requirements, there are no constraints on non-standard classes.
The rule I quoted about “same class” can of course be overridden for specific cases, but in the ANSI stansrd there is no overriding that would justify ‘x’ = #x. Really, strings of 21-bit codes are the “real” strings and other kinds of string are just storage optimisations. It is much simpler if there is one sort of string. For what it’s worth, in my Smalltalk implementation Symbol is not a subclass of String. That way I don’t have to worry about what Symbol>>at:put: does. (They do have a common abstract superclass.) On Tue, 4 Feb 2025 at 10:36 PM, Marcus Denker <marcus.den...@inria.fr> wrote: > > > > On 3 Feb 2025, at 06:33, Richard O'Keefe <rao...@gmail.com> wrote: > > > > Not that anyone else probably cares, but the ANSI standard says > > - for All objects x y, x = y if and only if y = x. > > The Smalltalk-80 mixup over String and Symbol violated this, > > ‘X’ = #x but #x ~= ‘x’. > > - two sequences are = iff they are the same size, corresponding elements > are =, AND they are instances of the same class. > > That seems to be a very limited view of equality (that the class has to be > the same for all definitions of equality). > > To me that means it models more the technical detail of Implementation, > not the Domain. > > > - String is not a special case. > > > > But String *is* a special case: > > 'hello' asWideString = 'hello' "true" > 'hello' asWideString class = 'hello' class "false" > > > Marcus