Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: •Re: Detecting function vs method in an AUTOLOAD?

by tilly (Archbishop)
on Apr 11, 2004 at 23:34 UTC ( #344299=note: print w/ replies, xml ) Need Help??


in reply to •Re: Detecting function vs method in an AUTOLOAD?
in thread Detecting function vs method in an AUTOLOAD?

It is documented that AUTOLOAD got inherited for functions by accident, that feature is deprecated, and it will break at some point in the future.

Why then should we actively discourage authors of AUTOLOADs who want to try to match future behaviour, now? Offering people no way to smooth the transition between how their code acts now and how it will act in some future release seems like a pretty serious omission to me.

Furthermore it means that adding an AUTOLOAD can introduce many unintended effects that you have no way around. (Which is probably one reason why inherited AUTOLOADs for functions is now deprecated.)

My attitude is this. A normal method has no way of knowing what package you tried to call it in. However an AUTOLOAD method has that information in $AUTOLOAD. Why? Because details of how you dispatched to AUTOLOAD can very reasonably affect what that AUTOLOAD should do. While I agree that a normal function or method should not guess, in an AUTOLOAD you may want that information for similar reasons.


Comment on Re: •Re: Detecting function vs method in an AUTOLOAD?

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (9)
As of 2014-12-26 05:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (165 votes), past polls