Eliminating assignments and variable syntax (accessors)

Stefan Matthias Aust sma at netsurf.de
Mon Aug 2 20:58:17 UTC 1999


>I've been following the accessors thread with great interest and  
>have a rough sketch for eliminating direct variable access from  
>Squeak.

[...and replace it with the way SELF accesses slots]

While I'm a big fan of SELF's idea to omit classes and use only objects
which play different roles I don't like the way SELF tried to minimalize
the syntax. They simulated local and object-level variables using slot
accessors (which isn't bad in itself) and represented this in the syntax
(which makes the code unusual and alien-looking IMHO).  It was Guy Steele's
speach at OOPSLA 98 which convinced me that too less syntax is even more
harmful to a language than too much.  IMHO, variable access should also
look like variable access. (I'd even go so far and use "a[1] := 4" instead
of at:put: for array access but that's another story)

I don't care whether the compiler uses direct slot access or accessor
methods to set and get values but I don't want to see that implementation
detail on the language level.

Actually I like the way Python deal with this.  Python has a number of low
level methods you can overwrite to change the behavior of default
operations like + or - but also for things like assignments, slot access or
indexed access.  I think this is only reason why Python is generally
considered as very easy to learn.  As a beginner you don't have to deal
with these implementation issues but as an expert, you can access the meta
level.

>Prepending 'thisContext' to the lookup chain for implied messages  
>brings arguments and local variables into the game, at least  
>conceptually (though of course a normal context won't respond to  
>these messages).

Why not?  This is how SELF works.

>Variables can be kept somewhat  
>private by not creating accessors for them.  Decisions to use direct  
>variable access are localized, not spread over all the code that  
>makes use of the variable.

I don't understand the last point?  How can you restrict the access by not
providing accessor methods if this would also mean that nobody can access
them. As I understood, you wanted to get rid of ":=" and direct variable
access altogether.  Without (public-accessable) methods you cannot use
these variables...


bye
--
Stefan Matthias Aust  //  Bevor wir fallen, fallen wir lieber auf.





More information about the Squeak-dev mailing list