Need feedback on simple idea

Noury Bouraqadi bouraqadi at ensm-douai.fr
Mon Apr 14 08:01:52 UTC 2003



Stephane Ducasse wrote :
 >
> remove direct access to instance variables a la self
>
> a class still defines instance variable but we cannot access directly 
> instance variables accessors are automatically optimized to use direct 
> access by the compiler.
>
I experimented this approach years ago. And I used the compilation 
technic in the implementation of MetaclassTalk to control instance 
variables reads/writes. Developpers write accesses to instance 
variables in the same way as in plain Smalltalk. However, the 
generated byte-code corresponds to a message send.

Now that the implementation is working, I'm exploring the idea on the 
conceptual level...


> Cons:
>     no private iv anymore anymore (except if we try to have a clever schema
>     that lets the programmer writing self x while the byte code remove 
> the send)
 >
Well, squeak allows having private methods. Their selectors should be 
prefixed with 'pvt'. The compilation fails when receiver for a 
messages with a such selector is **not** 'self' or 'super'.

> 
> Applicability to Squeak:
>     - would break all the accessors that do something more that accessing
>     (self changed) but we could use a dedicated parser/compiler so that the
>     changes only impact a subset.
> 
This is feasable. I experimented in MetaclassTalk, where only some 
classes have a specific compilation scheme...


Noury
-- 
------------------------------------------
Dr. Noury Bouraqadi - Enseignant/Chercheur
Ecole des Mines de Douai - Dept. G.I.P
http://csl.ensm-douai.fr/noury

European Smalltalk Users Group
http://www.esug.org

Squeak, an Open Source Smalltalk
http://www.squeak.org
------------------------------------------




More information about the Squeak-dev mailing list