Am 02.10.2008 um 08:50 schrieb Sean Allen:
If you wanted to take a mutable object and make it immutable and be able to go back again to mutable, how could you do that?
What is your use case?
In particular the part that has me as a smalltalk beginner stumped is how to disallow any messages that would result in a state change while still allowing messages that only read state.
Do you have to handle on a message by message basis? ( Eeek lots and lots of work ) Or is there something you could work into a superclass and use in its descendents? ( ideal for what I need. )
Well, it's hardly a beginner's topic, but you could make your class use a modified compiler that protects instance variable assignment by the check of an "immutable" flag.
This is basically how Avi's WriteBarrier works.
- Bert -