in reply to Re: Re: Re: Re: Re: Symbol table globbing from object refs
in thread Symbol table globbing from object refs
This discussion might be worth promoting to a root note, since there's a lot of philosophy involved.
I believe that you should override can when you provide an AUTOLOAD so that the normal Perl mechanisms work appropriately. I want to be able to ask "does this package or class or object have a subroutine or method of this name"?
Not providing can means I might get the wrong answer.
I'm not convinced by the point that you want to decide this at runtime — your can can use the same behavior as your AUTOLOAD. The same goes for returning the correct code reference. If you can get it right in one spot, you can get it right in another.
I also think that any programmer smart or experienced enough to get AUTOLOAD right is capable of getting can right. You're right that it can be tricky, but can is also documented.
If people get it wrong, well, people get all sorts of things wrong. That doesn't mean that no one should do those things.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: Re: Re: Re: Re: Re: Symbol table globbing from object refs
by tilly (Archbishop) on Nov 30, 2003 at 21:28 UTC |