[Interval Problem] 2 cents

Stephen Pope stp at create.ucsb.edu
Fri Jul 30 22:30:41 UTC 1999


Alan Kay wrote:
> 
> I agree Andreas -- but we could also point the finger at Smalltalk-80 and
> ask why doesn't it have a slot class that would allow us to change the
> meaning without having to worry about what the code looks like ...
>  [ ... ]
> I think that the Self way is pretty good and clean, since it extends
> referential transparency one more level. A little more of a metadescription
> would make things even nicer and more useful ...

Far be it for me to pick an argument with Alan, but I think that
Smalltalk's accessing messages are just what he's looking for. If you
only refer to an instance variable in the getter/setter accessing
methods, you can change it freely, and the rest of your code never has
to know. If you use any of the goodies for automatically generating
accessing methods, then you never have to see any state except when you
define a class.

Back when I taught Smalltalk regularly, we used the example of 2-D
points, which have methods such as x, y, x:, y:, r, theta, r: and
theta:. A client of this class has no idea or concern whether it
actually stores its coordinates using Cartesian or polar coordinates.
Only a benchmark test of the relative cost of translation and rotation
operations will tell, and if you do one of these much more than the
other, you're free to change the storage format of points with no other
side-effects.

-- 

Stephen Travis Pope  --  http://www.create.ucsb.edu/~stp
stp at create.ucsb.edu  --  stp9 at cornell.edu





More information about the Squeak-dev mailing list