Stephen --
Yes, it works fine from the outside where one has to send messages, but it's the inside case of: foo <- 59 that Smalltalk-80 lets you do that I don't like. This absolutely means munge that variable and there is no override possible -- I like self's gentler and more general approach that handles this from the inside as well. In other words: of course I think we should use accessors (that was one of my earliest ahas!) -- As I said, what I don't like is that Smalltalk permits the above case (and so many people can't refrain from using it, only to get bitten by the early binding later on ....)
Cheers,
Alan
-----
At 2:30 PM -0800 7/30/99, Stephen Pope wrote:
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@create.ucsb.edu -- stp9@cornell.edu