On 8/19/00 4:04 PM, Damian Conway wrote:
> You can have your cake, but not force us to eat it too...
Come, partake of the Loony Cake... :)
> Like $AUTOLOAD, $ME would be dynamically scoped:
>
> package LoonyBin;
>
> sub self {$ME};
>
> sub get_polite_age : method {
> return (self->age >= 40) ? 39 : self->age;
> }
Sure, provided that's standardized via...
> One might even imagine a standard pragma that automatically creates
> such things in any package with methods.
...and, most importantly, cleverly morphed into an efficient implementation
behind the scenes. We're supposed to be making Perl o-o *more* efficient,
not adding more subroutine calls. Convenience and performance should
not always have to be mutually exclusive.
> We seem to cope with $AUTOLOAD okay, without the need to:
>
> sub autoload : lvalue {$AUTOLOAD}
>
> all the time.
The operative word being "cope" ;) Also, I tend to write many more methods
than I do autoloaders (YMMV), so I'd almost definitely use an efficient,
convenient, implicit "self" bareword or scalar, whereas I'd probably just
stick with $AUTOLOAD the few times I have to use it.
-John