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

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?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://344299]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (7)
As of 2017-07-21 06:48 GMT
Find Nodes?
    Voting Booth?
    I came, I saw, I ...

    Results (319 votes). Check out past polls.