[Pharo-users] Re: Private Methods
Hi Esteban, Which first "class attribute" are you referring to? Is it a pragma? Can you provide an example please ? Thanx Noury On Aug 17 2021, at 10:31 pm, Esteban Maringolo wrote: > I don't understand the request? > > Wouldn't tagging methods as private (as a first class attribute, and > not only its category) be enough? > > What you ask for seems to be a splitted method dictionary of some sort. > Having first class private methods would save you from autocomplete > selector "pollution" of private methods. > > Regards! > Esteban A. Maringolo > On Tue, Aug 17, 2021 at 5:14 PM Craig Johnson wrote: > > > > Hi All, > > > > > > Just a newb off-the-wall question. > > > > Is there any good reason why we can't create a true private method in a > > Pharo class by putting that method inside an instance or class variable > > as a lambda (block). > > > > > > This would reduce one of my biggest bugbears with Pharo, namely the > > pollution of the global namespace with every single message name in the > > entire system. > > > > > > > > Craig >
[Pharo-users] Re: Private Methods
Hi Noury, In Dolphin Smalltalk and in IBM/VA Smalltalk, methods can be private, it's a special attribute of the CompiledMethod, so the visibility doesn't depend on a category name convention, and you can have both public and private methods sharing a single category. I used that attribute extensively in the previously described dialects, and it led to good method categorization, in the case of Dolphin, it had the nice thing of adding "Private - ..." to the method comment when you toggle a method as private. I'm fine with the current state of everything being public, but if we were to have that public/private distinction that would be the simplest solution, having a pragma could also work, but I think that in terms of performance it could impact the lookup. I don't know, however, if that is what the original request was after. Best regards, Esteban A. Maringolo On Wed, Aug 18, 2021 at 9:47 AM Noury Bouraqadi wrote: > > Hi Esteban, > > Which first "class attribute" are you referring to? Is it a pragma? Can you > provide an example please ? > > Thanx > Noury > > On Aug 17 2021, at 10:31 pm, Esteban Maringolo wrote: > > I don't understand the request? > > Wouldn't tagging methods as private (as a first class attribute, and > not only its category) be enough? > > What you ask for seems to be a splitted method dictionary of some sort. > > Having first class private methods would save you from autocomplete > selector "pollution" of private methods. > > Regards! > > Esteban A. Maringolo > > On Tue, Aug 17, 2021 at 5:14 PM Craig Johnson wrote: > > > > Hi All, > > > > > > Just a newb off-the-wall question. > > > > Is there any good reason why we can't create a true private method in a > > Pharo class by putting that method inside an instance or class variable > > as a lambda (block). > > > > > > This would reduce one of my biggest bugbears with Pharo, namely the > > pollution of the global namespace with every single message name in the > > entire system. > > > > > > > > Craig
[Pharo-users] Re: Private Methods
As Esteban pointed out there are some dialects with proper support for that. But the semantics is the same as in Pharo, you can still send these messages. It is more a warning to the programmer, and the browser shows you these methods with a particular icon or has tabs so you can easily filter out the methods marked as private. A least in VA is done by attaching some metadata to the methods and not changing its source code. On Wed, Aug 18, 2021 at 10:32 AM Esteban Maringolo wrote: > Hi Noury, > > In Dolphin Smalltalk and in IBM/VA Smalltalk, methods can be private, > it's a special attribute of the CompiledMethod, so the visibility > doesn't depend on a category name convention, and you can have both > public and private methods sharing a single category. I used that > attribute extensively in the previously described dialects, and it led > to good method categorization, in the case of Dolphin, it had the nice > thing of adding "Private - ..." to the method comment when you toggle > a method as private. > > I'm fine with the current state of everything being public, but if we > were to have that public/private distinction that would be the > simplest solution, having a pragma could also work, but I > think that in terms of performance it could impact the lookup. I don't > know, however, if that is what the original request was after. > > Best regards, > > Esteban A. Maringolo > > On Wed, Aug 18, 2021 at 9:47 AM Noury Bouraqadi > wrote: > > > > Hi Esteban, > > > > Which first "class attribute" are you referring to? Is it a pragma? Can > you provide an example please ? > > > > Thanx > > Noury > > > > On Aug 17 2021, at 10:31 pm, Esteban Maringolo > wrote: > > > > I don't understand the request? > > > > Wouldn't tagging methods as private (as a first class attribute, and > > not only its category) be enough? > > > > What you ask for seems to be a splitted method dictionary of some sort. > > > > Having first class private methods would save you from autocomplete > > selector "pollution" of private methods. > > > > Regards! > > > > Esteban A. Maringolo > > > > On Tue, Aug 17, 2021 at 5:14 PM Craig Johnson > wrote: > > > > > > Hi All, > > > > > > > > > Just a newb off-the-wall question. > > > > > > Is there any good reason why we can't create a true private method in a > > > Pharo class by putting that method inside an instance or class variable > > > as a lambda (block). > > > > > > > > > This would reduce one of my biggest bugbears with Pharo, namely the > > > pollution of the global namespace with every single message name in the > > > entire system. > > > > > > > > > > > > Craig >
[Pharo-users] Re: Private Methods
I found this useful when creating commercial frameworks for VAST. For instance, in the printing framework, I used the idea of a turtle (from turtlegraphics) to create pages. All the turtle commands - turn(50) etc - were public but the code that actually created the printing code was all private. Hence purchases knew not to touch the private methods. David > On 18 Aug 2021, at 14:31, Esteban Maringolo wrote: > > Hi Noury, > > In Dolphin Smalltalk and in IBM/VA Smalltalk, methods can be private, > it's a special attribute of the CompiledMethod, so the visibility > doesn't depend on a category name convention, and you can have both > public and private methods sharing a single category. I used that > attribute extensively in the previously described dialects, and it led > to good method categorization, in the case of Dolphin, it had the nice > thing of adding "Private - ..." to the method comment when you toggle > a method as private. > > I'm fine with the current state of everything being public, but if we > were to have that public/private distinction that would be the > simplest solution, having a pragma could also work, but I > think that in terms of performance it could impact the lookup. I don't > know, however, if that is what the original request was after. > > Best regards, > > Esteban A. Maringolo > > On Wed, Aug 18, 2021 at 9:47 AM Noury Bouraqadi wrote: >> >> Hi Esteban, >> >> Which first "class attribute" are you referring to? Is it a pragma? Can you >> provide an example please ? >> >> Thanx >> Noury >> >> On Aug 17 2021, at 10:31 pm, Esteban Maringolo wrote: >> >> I don't understand the request? >> >> Wouldn't tagging methods as private (as a first class attribute, and >> not only its category) be enough? >> >> What you ask for seems to be a splitted method dictionary of some sort. >> >> Having first class private methods would save you from autocomplete >> selector "pollution" of private methods. >> >> Regards! >> >> Esteban A. Maringolo >> >> On Tue, Aug 17, 2021 at 5:14 PM Craig Johnson wrote: >>> >>> Hi All, >>> >>> >>> Just a newb off-the-wall question. >>> >>> Is there any good reason why we can't create a true private method in a >>> Pharo class by putting that method inside an instance or class variable >>> as a lambda (block). >>> >>> >>> This would reduce one of my biggest bugbears with Pharo, namely the >>> pollution of the global namespace with every single message name in the >>> entire system. >>> >>> >>> >>> Craig