[Newbies] 'locking' an object
bert at freudenbergs.de
Thu Oct 2 20:45:11 UTC 2008
Am 02.10.2008 um 12:44 schrieb Matthew Fulmer:
> On Thu, Oct 02, 2008 at 02:55:34PM -0400, Sean Allen wrote:
>> On Oct 2, 2008, at 1:18 PM, Bert Freudenberg wrote:
>>>> 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?
>> use case.
>> system needs to track changes to itself.
>> one option that has come up is...
>> linked list of different 'versions' of same object.
>> head is the live object. everything else past versions.
>> want to mutate object? you have to 'unlock'.
>> unlocking gives you a new copy and updates the linked list,
>> allowing all the accessors that mutate state to work.
>> when locked, calling one of those accessors would result in
>> an error. but when locked, read access still needed.
>> if i can find a way to put this in a superclass and have
>> children get the functionality w/o doing anything else,
>> then i really like it.
> heh. I'm making something that creates a new object version
> whenever an ivar is changed. I'm using tweak's fields and
> compiler to do it, so it will only work in a Croquet image.
> Not to mention that I've just barely started. The code is at
That seems to be en vogue right now ... see
- Bert -
More information about the Beginners