in reply to Re: Question on use of Super with OO programing
in thread Question on use of Super with OO programing
Since an object reference is always the first parameter passed when a method is invoked via '->', unless you the object reference from the argument list, you'll get two of them if you pass @_ to another object method.
I was just contemplating this recently, feeling a little irked that @_ has to be babysat in such a manner. Do you suppose it would be feasible for the magic of @_ to be expanded so that if passed unmodified to another method the first element be replaced with the new head of the current argument stack?
I suppose it would be necessary to look at whether the subroutine was invoked with Pkg::func or like Pkg->method/$obj->method, and ensure that some reference had been taken to that first element in the enclosing scope even if of the form my ($obj) = @_, but surely this must be possible.
Edit by ar0n -- Runaway <i>
|
|---|