Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re^2: Private Methods Meditation

by stvn (Monsignor)
on Jul 19, 2004 at 14:22 UTC ( [id://375562]=note: print w/replies, xml ) Need Help??


in reply to Re: Private Methods Meditation
in thread Private Methods Meditation

This voluntary cooperative model of OO gives the screaming horrors to Smalltalkers and other purists, but it leaves a lot of space for us to work in.

Most versions of Smalltalk do not actually have any notions of public/private/protected in the way Java/C++ does. Instead Smalltalk's notion of private methods is very similar to perl's, "If you weren't invited, don't come in". Smalltalk has things called method categories, which in the language are really are nothing more than syntactic sugar, but when you combine it with the Smalltalk environment, in particular the Smalltalk code browser, you have another layer of organization between the class-level and method-level. Typically Smalltalk programmers will put all their private methods into the "Private" category. Some Smalltalk implementations will complain (the equivalent of warn) when you call a method that is prefixed with an _ from outside of your class, but none (at least that I know of) will actually enforce this and not let you compile your code. Here is a link that goes into more detail if you are intetested.

-stvn

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://375562]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (5)
As of 2024-04-19 09:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found