[Newbies] Private metods as my*?
david.mitchell at gmail.com
Fri Mar 2 05:56:02 UTC 2007
And note that the pvt prefix is Squeak specific.
I tried the my prefix for a while on instance variables, but not
methods(think Kent Beck's _Smalltalk Best Practice Patterns_ had a
section on it). I prefer method categories that group by intended use
(published, public, private, etc.)
One of the things I love about Smalltalk is the lack of access control.
Bert Freudenberg wrote:
> On Feb 27, 2007, at 22:05 , Blake wrote:
>> I'm trying to fill in the gaps in my Smalltalk knowledge and so
>> am going through some of the free books (thanks, Steph!). Right now
>> I'm looking at "Smalltalk By Example" where it talks about the
>> absence of private messages. (I've run up against methods that were
>> private I've needed so much in other langauges that I'm not a big
>> fan of the concept, but that aside...)
>> Anyway, it suggests using a my- prefix for privates and an fr-
>> for friends (or "protected", I guess).
> I've never seen a "fr" prefix, and seldomly a "my". To emphasize
> privacy, "private" seems to be the most common prefix (just check a
> regular image).
> There is also a private prefix that is even enforced by the compiler:
> "pvt". It will only allow to send this to "self". This should only be
> used in highly sensitive places, if at all.
> - Bert -
> Beginners mailing list
> Beginners at lists.squeakfoundation.org
More information about the Beginners