in reply to use fields, underscores and subclasses
So, how do I create variables that are visible to subclasses but tell the user not to use them if they know what's good for them?Well, first of all, (IMO), it's never a good idea to access attributes from other classes (or objects) directly. So the user doesn't need to be told that it's a bad idea for a specific class - it's always a bad idea.
Second, if you want to tell the user something, use POD.
If perl doesn't have a concept of protected variables, then class inheritance becomes pointless, surely.Well, Perl doesn't even have the concept of object instance variables. Can't really blame Perl not to have a specific flavour of a thing it doesn't have to begin with. Perl's OO is the opposite of the rest of Perl. Most of Perl is about programmer convenience, letting the programmer focus on the important things, and having the language take care of the details. But when it comes to OO, Perl gives the programmer only two things: @ISA and bless. And that's it. Everything else you have to do yourself.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: use fields, underscores and subclasses
by MattLG (Beadle) on Nov 23, 2008 at 02:01 UTC | |
by JavaFan (Canon) on Nov 23, 2008 at 02:29 UTC | |
Re^2: use fields, underscores and subclasses
by LanX (Saint) on Nov 23, 2008 at 01:09 UTC | |
by Anonymous Monk on Nov 23, 2008 at 01:45 UTC | |
by ikegami (Patriarch) on Nov 23, 2008 at 01:48 UTC | |
by LanX (Saint) on Nov 23, 2008 at 02:10 UTC | |
by ikegami (Patriarch) on Nov 23, 2008 at 02:50 UTC | |
| |
by LanX (Saint) on Nov 23, 2008 at 01:56 UTC |