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

Martin McClure martin at hand2mouse.com
Sat Feb 2 01:05:15 UTC 2002


At 3:15 PM -0800 2/1/02, Tim Rowledge wrote:
>This is the initial report for the VI4 Project group.
>
>Goal: This project is intended to gather together all the vm and vi
>related changes that have been proposed and which require a different
>image format.
>

[...]

>
>Plans: Any further proposals for image format affecting changes are
>needed as soon as possible; this is not something we want to do more
>than once.


I do have an image format enhancement I've been considering... and it 
seems now is the time.

Here's a very brief proposal. I can fill in details later, but I want 
let you know right away the basic idea.

I'd like to have a bit in the object header for the purpose of 
marking an object immutable.

Impact:
I haven't seen the other proposals that affect the header, so I can't 
yet say what if anything I'm proposing to move out of the header to 
make room.

Semantics:
New objects are created with the immutability bit cleared. There are 
primitives for setting and clearing the bit. If the bit is set and an 
attempt is made to alter any of the instance variables of the object, 
the VM takes some special action instead (most likely, an exception 
is raised). There are higher-level facilities that invoke the setting 
and clearing primitives, and for dealing with exceptions.

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.

Others you can modify, but you want to know when it happens. This is 
really useful in implementing object synchronization when the same 
logical object has a physical representation in more than one space. 
It's good for distributed object systems, object persistence systems 
(my particular interest), object-relational persistence frameworks, 
and the like.

Alternatives:
The alternatives for detecting object modifications are really 
awkward; this is a much easier way to do it.

Well, that's the barebones version. Let me know what you think... 
(not that this group is usually afraid to speak up :-)

-Martin



More information about the Squeak-dev mailing list