Eliminating assignments and variable syntax (accessors)

Marcel Weiher marcel at system.de
Wed Aug 4 07:50:57 UTC 1999


> > It's bad enough that all methods have to be recompiled when the
> > slot definitions are changed.  Such recompilation is inelegant,
> > time consuming, brittle, and requires the compiler to be present 
> > in order for methods to be added or removed (and also for
> > classes to be added or removed)--even when all added or changed
> > methods are already precompiled.  Think of the consequences
> > for moving behavior over the net!
>
> Ammendment #1:
>
> If an accessor method is introduced in a subclass, but does not exist 
> in the superclass, you CANNOT just recompile the methods in the  
superclass
> that access the variable so that they send a message.  What  
message would
> they send? There may be a method with such a selector just added  
to one of the
> subclasses, but that method is not callable by instances of the  
superclass!
> So one would have to add such a method to the superclass "behind  
the scenes."
> Now, would this method show up in the browser?  Where would its
> source code be found?  What if someone just removes it, since it may 
> not be obvious why it's there?  How would it be automatically removed 
> if the method in the subclass that necessitated its addition (or  
the whole
> subclass) is later removed?

This is exactly why with my version, superclasses with direct access  
would not be affected by subclass definitions of accessors (just  
like now).  The only time recompilation happens is if a *superclass*  
defines accessor methods (or removes them) for one of its instance  
variables.  In that case, any access of that variable in *subclasses*  
has to be recompiled.

Today, introducing an accessor in a superclass would not change the  
direct access in subclasses.  They would continue to use direct  
access, with likely dire consequences.  To avoid these consequences,  
it becomes necessary to hunt down (with assistance) all accesses and  
change them to use message sends.  In the reverse case, removing an  
accessor, a "message not understood" error would result.  Again, it  
would be necessary to hunt down all references to the accessor and  
change them to direct access.

Of course, since it seems that (almost) no-one has actually  
understood my proposal, its semantics are probably just too  
complicated.  ( "But," he cries, "they are almost identical to what  
is there now!?")

:-/

Marcel





More information about the Squeak-dev mailing list