Arrays / collections with literal syntax - fixed size?

Alexander Lazarevic' Alexander at Lazarevic.de
Sun Jan 6 07:12:46 UTC 2008


Randal L. Schwartz schrieb:
> The intent of an array is that it's readonly ("immutable").
>   
?

So why does "#(1 2 3) at: 1 put: 5; yourself" evaluate to "#(5 2 3)" ?

Instances of Array have fixed sizes, yes. But I would not say that makes
them readonly.

This works in Squeak too:
'Boy' at: 1 put: $T evaluates to 'Toy'

It won't work in (latest versions of) VisualWorks, where you have
immutable literal strings.
> And this belongs on -beginners, not -dev.
>   
I don't think so.

Alex



More information about the Squeak-dev mailing list