Greetings,
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). Thoughts? ===Blake=== _______________________________________________ Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners |
On Feb 27, 2007, at 22:05 , Blake wrote: > Greetings, > > 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). > > Thoughts? 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 [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners |
On Tue, 27 Feb 2007 13:24:25 -0800, Bert Freudenberg
<[hidden email]> wrote: > 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. Thanks, Bert. So, that's a commonly held value in Smalltalk, i.e., privates should be severely limited if used at all? (I highly incline that way myself.) _______________________________________________ Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners |
On Mar 2, 2007, at 1:56 , Blake wrote: > On Tue, 27 Feb 2007 13:24:25 -0800, Bert Freudenberg > <[hidden email]> wrote: > >> 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. > > Thanks, Bert. > > So, that's a commonly held value in Smalltalk, i.e., privates > should be severely limited if used at all? (I highly incline that > way myself.) Well, usually they are just put in a "private" category. Also, a selector like like "setX:" indicates that this is not a generic accessor, because that one would be "x:". - Bert - _______________________________________________ Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners |
On Thu, 01 Mar 2007 17:21:44 -0800, Bert Freudenberg
<[hidden email]> wrote: >>> 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. >> >> Thanks, Bert. >> >> So, that's a commonly held value in Smalltalk, i.e., privates should be >> severely limited if used at all? (I highly incline that way myself.) > > Well, usually they are just put in a "private" category. Also, a > selector like like "setX:" indicates that this is not a generic > accessor, because that one would be "x:". Right: I was referring more to the concept of scope. It's more a matter of manners--or perhaps better, of being damn sure you know what you're doing, versus being restricted by the environment. (Hence, less use of the "pvt" prefix.) _______________________________________________ Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners |
In reply to this post by Bert Freudenberg
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: > >> Greetings, >> >> 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). >> >> Thoughts? > > > 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 > [hidden email] > http://lists.squeakfoundation.org/mailman/listinfo/beginners > _______________________________________________ Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners |
Free forum by Nabble | Edit this page |