On Apr 7, 2008, at 10:28 PM, Alessandro Warth wrote:

Yeah, that looks like an "oops" (sorry, I couldn't resist). First, new: makes _oops point to a freshly-allocated chunk of memory,
then we make it point elsewhere, creating unnecessary work for the GC.

The Compiler tried to create unique contents for any given literal no matter how many times that literal appears in the program. If you don't allocate new storage you alias each occurrence of a given literal, so

a := #(1 2 3).
b := #(1 2 3).
a at: 1 put: 4.  "(b at: 1) == 4"

which is probably not what you wanted. The removal of the assignment in size_:value_: is the correct fix. The assignment was accidentally left in when the method was copied from st80/Array.st, where no new allocation of the contents array is done and aliasing of the contents is not a problem because literals are immutable and the above scenario becomes illegal.

HTH,
Ian




_______________________________________________
fonc mailing list
[email protected]
http://vpri.org/mailman/listinfo/fonc

Reply via email to