string sharing (possible bug?) [long]

Adam P. Jenkins ajenkins at javanet.com
Thu Dec 10 16:36:59 UTC 1998


> Some questions about this:  does the ANSI standard have anything to say
> about the behavior of literals?  It's pretty well explained why things
> happen and why it's efficient that it happens, but is it correct?

Someone else on here said that the ANSI standard leaves it undefined whether
literals can be modified, and whether literals should be unique or not.  So
Squeak is compliant in this respect, but if it used immutable literals, or
didn't share literals, it would also be compliant.

Adam

>
> Does the object generated by the compiler for a literal string
> need to have
> class == String?  Couldn't it be another object, perhaps referencing a
> literal array which implements copy-on-change semantics?
>
> -rj
>
>





More information about the Squeak-dev mailing list