in reply to Re: OO in Perl 5: still inadequate
in thread OO in Perl 5: still inadequate
You can’t use phrases like “on par” and “inadequate” without also explaining your metric.
I did lay out the metric; that’s what the post was about.
So, who should win?
What I am after will offend some people’s sense of beauty, but works out favourably on all other metrics, near as I can tell. Which is just why I want it.
In my experience, no level of language enforcement stops bugs.
I’m not looking for enforcement – I said as much in the post, right? I want encapsulation to be the default situation, but not the only one. I want to be able to write a subclass without worrying about what any superclass is doing under the covers, because I’m secure in the knowledge that if I don’t go rooting around for anyone’s underwear, I won’t run into it. It’s the same principle as global variables.
Just wait to the dumb kids start using Ruby to see a lot of bad Ruby code.
This the exact point I made in an article on lesscode.org.
I don’t mind that Perl allows people to break encapsulation.
I would mind if it didn’t. (Ruby allows it too, for that matter.)
That some people can do bad things doesn’t convince me that I should give up using Data::Dumper on an object without creating an as_dumped_string method in every class.
Precisely. And more to the point, being able to break encapsulation allows abstractions that are impossible in a language with enforced encapsulation. And that, I really care about. A tool with which you can’t do any damage is worthless.
I’m not asking for strong encapsulation, I am after an OO approach where isolation is the default, so I won’t have to worry about accidentally breaking superclass code, just because I decided to use a private instance variable that happens to be named the same as a private instance variable in one of the superclasses.
Hence “advisory encapsulation.”
Makeshifts last the longest.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: OO in Perl 5: still inadequate
by brian_d_foy (Abbot) on Jan 21, 2006 at 17:01 UTC | |
by Aristotle (Chancellor) on Jan 21, 2006 at 17:16 UTC | |
by brian_d_foy (Abbot) on Jan 21, 2006 at 17:28 UTC | |
by Aristotle (Chancellor) on Jan 21, 2006 at 18:51 UTC |