After making sure a string was not interned, ( "Symbol findInterned: 'test123'" returned nil ), I did
| s | s := #TEST123. s translateToLowercase. s -> (Symbol findInterned: s)
and the resulting s is a Symbol and it is not interned. To make sure that the primitive is invoked (and not its fallback code), put a halt in ByteString class >> #translate:from:to:table:
In modern Squeak image, literals are protected by immutability flag, and the primitive correctly check for immutability of receiver and fails. The example is thus not reproducible anymore in Squeak.
We also fail to reproduce if we use asSymbol rather than a literal:
| s | s := 'TEST123' asSymbol. s translateToLowercase. s -> (Symbol findInterned: s)
because `Symbol>>intern:` is also protecting the symbol by sending `beReadOnlyObject`.
The fact that the Symbol is not interned: is not a VM problem, it's an implementation detail at image side. I thus suggest to close this issue which is now correctly guarded at image side.
Cuis might still suffer from the problem, but let me suggest that Cuis do the right thing and protect Symbols from mutation too.
Closed #561.
vm-dev@lists.squeakfoundation.org