Basilides has asked for the wisdom of the Perl Monks concerning the following question:
frankus notes that the underbar convention--$self->{_words}--should be used only for "private properties" and quotes perltoot:
But I'm still a bit confused. My variables are private properties, I guess, in that they can't be directly accessed by other objects. They're not methods tho'.Occasionally you'll see method names beginning or ending with an underscore or two. This marking is a convention indicating that the methods are private to that class alone and sometimes to its closest acquaintances, its immediate subclasses. But this distinction is not enforced by Perl itself. It's up to the programmer to behave.
Basically, I've got a pretty vast project, where all private object variables have the underscore in their name. If this is just plain wrong, I'll change them all. If it's not, well that's a relief.
Cheers
Dennis
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Naming convention for Object Variables
by Joost (Canon) on Aug 13, 2002 at 13:52 UTC | |
Re: Naming convention for Object Variables
by fuzzyping (Chaplain) on Aug 13, 2002 at 13:55 UTC | |
Re: Naming convention for Object Variables
by lachoy (Parson) on Aug 13, 2002 at 13:43 UTC | |
by Abigail-II (Bishop) on Aug 13, 2002 at 13:59 UTC | |
by lachoy (Parson) on Aug 13, 2002 at 15:54 UTC |