On Thu, 31 Jul 2008 21:28:03 +0200, Igor Stasenko wrote:
...
I think it should be sealed by behavior, by preventing any methods, which can modify an instance, to appear in class.
This is no con for the other proposals, but pro for the best that I've ever seen :)
Go Smalltalk, go ! :)
/Klaus
So, the only real thing which can guarantee that given object remain unchanged during its lifetime is a class. An immutability bit is much worse thing comparing to this.
And second, its against the spirit of smalltalk. Smalltalk is one of the languages, where it tries to implement all things through behavior, not through using different VM/language magic intrinsics. It is not a problem, what VM having or not having an immutablity bit, its a problem, that current kernel classes and/or collections designed without looking at possible use cases where user wants to prevent object from being changed during its lifetime. So, maybe we should think how to refactor these classes instead of including one more magic thing?