Tips and tricks?

Alexandre Bergel bergel at iam.unibe.ch
Thu Mar 11 15:00:32 UTC 2004


> I particularly like the test that Dave
> Ungar would do on every Smalltalk system he came in contact with: Add a
> new instance variable to Object

With Squeak if you add an instance variable to a class, it is placed before the IVs present in the subclasses. For instance if you a class A with no IV, and a class B with iv1 as IV, iv1 has the offset 0. It you add a variable iv2 in A, iv1 get the offset 1.

Perhaps the issue of adding IV to Object can be resolve if the offset of already existing IV are preserved. Like that the problem with the class definition would be avoided....

Is it doable?

Alexandre


> work, but in practice often becomes impractical.  I don't think any
> Smalltalk system in that era (late 80s-early 90s) could actually do this
> (there is a deep hard problem with changing the shape of objects whose
> layout is know to the vm-implementation itself--but these are quite few
> in number).  But their failure modes were quite interesting: ranging
> from notifiers saying sorry can't do that, to infinite looping, to
> recursive does not understand, to process and or machine lockups and
> crashes. 
> 
> -----Original Message-----
> From: squeak-dev-bounces at lists.squeakfoundation.org
> [mailto:squeak-dev-bounces at lists.squeakfoundation.org] On Behalf Of
> ducasse
> Sent: Wednesday, March 10, 2004 9:27 AM
> To: The general-purpose Squeak developers list
> Subject: Re: Tips and tricks?
> 
> romain
> no reread my email. the problem is that reference to instance variables 
> are converted to offset in the bytecode. So this is not sure that if 
> you allow to add a method that the right offset will be found 
> especially because you do not want
> to recompile all the code. (may be there is a trick or heuristic 
> sorting the
> iv but I did not go deep enough into it)
> 
> Stef
> 
> On 10 mars 04, at 16:38, Romain Robbes wrote:
> 
> > Hi stef,
> >
> > Would the AddInstanceVariableRefactoring solve your
> > problem ?
> > Just wondering ...
> 
> 
> 

-- 
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.iam.unibe.ch/~bergel
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.



More information about the Squeak-dev mailing list