Arrays / collections with literal syntax - fixed size?
Alexander at Lazarevic.de
Sun Jan 6 20:54:52 UTC 2008
> It's the fact that #(..) is a literal.
> And modifying a literal is a bad practice, whatever the language.
Now I was under the impression, that a context had a copy of a compiled
method with copies of the literals, so that you could only modify the
copies but not the literals in the compiled method. But it seems not to
be that way:
"5 timesRepeat: [Transcript show: Play test printString; cr]"
| a |
a := #(1).
a at: 1 put: ((a at: 1) + 1).
This is evil! :)
More information about the Squeak-dev