develooper Front page | perl.perl6.language | Postings from June 2005

Re: AUTLOAD and $_

Thread Previous | Thread Next
John Macdonald
June 20, 2005 17:10
Re: AUTLOAD and $_
Message ID:
On Mon, Jun 20, 2005 at 04:37:31PM -0600, Luke Palmer wrote:
> On 6/20/05, chromatic <> wrote:
> > On Mon, 2005-06-20 at 12:11 +0200, Juerd wrote:
> > 
> > > I think there exists an even simpler way to avoid any mess involved.
> > > Instead of letting AUTOLOAD receive and pass on arguments, and instead
> > > of letting AUTOLOAD call the loaded sub, why not have AUTOLOAD do its
> > > thing, and then have *perl* call the sub?
> > 
> > Who says AUTOLOAD will always either call a loaded sub or fail?
> Uh, what else can it do?  It doesn't have to load a sub to return a
> code reference.
> Luke

I recall Damian using AUTOLOAD (in perl5) to evaluate the
result of the function call without loading a function with the
given name.  This was to allow arbitrary names to be invoked,
when the same name is unlikely to be used again.  This was
basically a method that took a string contant argument, but
it used the method name as the constant and didn't need to
specify a name for the actual ccmmon method.

I'm not certain that this is actually a worth supporting, it's
more of a golf/obfuscation technique than a significant tool,
unless there are additional clever uses of the technique that
go beyond this basic trick.


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About