identity in Squeak

Tommy Thorn tt1729 at yahoo.com
Mon Jun 17 02:18:21 UTC 2002


> Some Smalltalks (VisualWorks 7, for instance)
> enforce the immutability of literal strings.
> 
> Squeak does not enforce immutability, but it does
> assume that literal strings will not be changed, 
> so if it sees two equal literal Strings 
> in the same compilation unit it only creates one
> String object to save space.

Marking immutable objects and enforcing it also
makes it possible to merge different instances
of the same immutable object, using a scan of the 
whole heap.  Not that you would want to do it 
often, but before shipping an image it might be 
worthwhile.

It probably would gain much in the case of Strings,
but say, if we had immutable Points it could be 
interesting.

If I knew how to scan all objects, I would run
this experiment: Pretending for the moment that 
all Strings and Points are immutable, count the
numbers of bytes that could be save by merging
identical instances.

Squeak is awesome,

  Tommy


__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com



More information about the Squeak-dev mailing list