Image format proposals... Re: [SqF]Report of VI4 Project for Feb '02

Martin McClure martin at hand2mouse.com
Sun Feb 3 01:35:33 UTC 2002


At 7:46 PM -0400 2/2/02, Lex Spoon wrote:
>  > I'd like to have a bit in the object header for the purpose of
>>  marking an object immutable.
>>
>[...]
>>  Usefulness:
>>  There are two basic classes of uses for this capability.
>>  1) Preventing the modification of an object
>>  2) Detecting the modification of an object
>>
>>  Some objects just shouldn't be modified -- Symbols, method literals, etc.
>>
>
>For this particular purpose, you can don't need an immutable bit, and
>I'm not sure it really helps.  I've actually gone through and made such
>things as immutable as makes sense for Smalltalk, and it only required
>being careful about what methods were available.  (Well, and I added a
>new debugger-level primitive for modifying instance variables of an
>object other the receiver.  That is, instead of instVarAt:put:, it was
>instVarOf:at:put:.).  It's more flexible to do it this way, anyway,
>because you can code the methods to be partially restrictive if you
>want.  In fact, it's what we already do with methods, anyway --
>sometimes a method will respond with "No".

Agreed, there are enough other ways to solve this problem that are 
"good enough."

>
>
>For a persistence framework, etc., I have no idea.

This second class of usage is the primary motivation for adding the 
header bit. All the alternatives to this that I've seen either 
severely limit the functionality or are extremely ugly.

So I still think the proposal to be worth seriously considering.

-Martin



More information about the Squeak-dev mailing list