Squeak vs. privacy

Igor Stasenko siguctua at gmail.com
Thu Oct 18 03:40:23 UTC 2007


To make your methods really private, without changing anything in
smalltalk , you can just create a new class with your 'private'
methods, and add instance var to your original class, which will hold
instance of this class.
Make no accessors to this inst var , and in own code you can freely
send messages to this 'private' instance.

Of course, this haves own glitches, since you need to split your
object state and behavior over 2 classes, but i don't think this is
really a problem.
It does what you want - makes part of your object behavior private and
invisible outside, so what the difference?

And i don't think that this is worth at all. Try think different, try
use best of ST powers and don't try to apply usage patterns from other
languages.
This is common mistake trying to use same approaches for different
environments.
I think that ST have enough features to provide privacy.

-- 
Best regards,
Igor Stasenko AKA sig.



More information about the Squeak-dev mailing list