Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Re: AUTOLOAD does not scale

by dragonchild (Archbishop)
on May 27, 2004 at 15:19 UTC ( [id://356937]=note: print w/replies, xml ) Need Help??


in reply to Re: AUTOLOAD does not scale
in thread OO Inheritence

--! Bad saint, no cookie.

Yes, it's perfectly possible to have AUTOLOADs in the same inheritance tree. You can even have them dispatch to one another. And, this would be a very obfuscated version of spaghetti programming. (Yes, spaghetti that's further obfu'ed!)

Think for a second about how you would go about maintaining that kind of programming. I know which one I'd prefer to maintain!

(By maintain, I mean that there was a wizard who wrote the software, N normal humans who extended it, and now I am handed the mess.)

------
We are the carpenters and bricklayers of the Information Age.

Then there are Damian modules.... *sigh* ... that's not about being less-lazy -- that's about being on some really good drugs -- you know, there is no spoon. - flyingmoose

I shouldn't have to say this, but any code, unless otherwise stated, is untested

Replies are listed 'Best First'.
Re: Re: Re: AUTOLOAD does not scale
by runrig (Abbot) on May 27, 2004 at 16:13 UTC

    NEXT or something like it will be built into Perl 6. People will start using it. And abusing it. And much obfu/spaghetti code will be written. But I'm still glad it's there in case I want it. (And I didn't know there was a NEXT for Perl 5, so thanks adrianh (for informing me of it)...and TheDamian (for writing it)!).

    And let me reiterate that the only reason I disagreed with rir in the first place was because of the complaint about having multiple AUTOLOAD's in the inheritance tree, yet the OP had only one AUTOLOAD, in the base class, and with no multiple inheritance as in rir's later example. I might say the same things about maintainability when you start using multiple inheritance, but I won't :-)

Re^3: AUTOLOAD does not scale
by adrianh (Chancellor) on May 28, 2004 at 11:14 UTC
    --! Bad saint, no cookie.

    The statement that "Two AUTOLOADs cannot coexist amicably in the same inheritance tree" is factually incorrect and that's the only point that I am making.

    I rarely use AUTOLOAD since there is usually a better alternative. Yes it can be used badly to produce ghastly code. However, just like local, it can occasionally be very useful. It is perfectly possible to write very straightforward non-obfu code with AUTOLOAD.

    Talking about how to use AUTOLOAD well/badly is a good thing. Blanket statements that are factually incorrect are not (IMHO anyway. YMMV).

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (6)
As of 2024-03-28 22:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found