Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Re: What is this can() and why is breaking it (un)acceptable?

by hardburn (Abbot)
on Apr 06, 2004 at 16:58 UTC ( #343015=note: print w/ replies, xml ) Need Help??


in reply to Re: What is this can() and why is breaking it (un)acceptable?
in thread Why breaking can() is acceptable

Your class then has an obligation (IMO of course) to provide a working version of can in its interface.

If we are talking from an OO purity point of view, I would agree. Anything that breaks inheritance is evil and must be avoided.

OTOH, a lot of people agree that multiple inheritance is needed in some cases, but there is no good way to implement it. How do you handle dimand inheritance? In what order do you call destructors (something that's been an issue on the Squawks of the Parrot blog of late)? There's no good answer, and an awful lot of bad ones.

Abigail-II gave a great example in this thread of how easy it is to break inheirtance in Perl (one which I hadn't considered before). If you implement your class as a hashref, all your parents and subclasses also must use a hashref. Which might be the most common case, but it isn't the only one.

Observation: this thread is a case study in why Perl's object system is hacked on.

----
: () { :|:& };:

Note: All code is untested, unless otherwise stated


Comment on Re: Re: What is this can() and why is breaking it (un)acceptable?
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (8)
As of 2014-07-23 02:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (131 votes), past polls