develooper Front page | perl.perl5.porters | Postings from March 2000

Re: AUTOLOADREF

Thread Previous | Thread Next
From:
Ilya Zakharevich
Date:
March 16, 2000 12:55
Subject:
Re: AUTOLOADREF
Message ID:
200003162055.PAA22591@monk.mps.ohio-state.edu
M.J.T. Guy writes:
> > See my proposal on 'use autoload'.
> 
> Where can I find that?    All I could find in the archives is
> 
> http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2000-01/msg01381.html
> 
> which is, err, short on detail.

Do you feel more detail is needed?  All we need is to let the lexer
know the prototype *when it needs it*, and let the interpreter know
the subroutine *when it needs it*.

So two entry points should be defined.  Given that they can have any
side effects (such as installing the subroutine), no additional
details are needed.

> > No new magic names, please!  In my proposal what you want would be
> > installed by
> >
> >   use autoload body => \&AUTOLOADREF;
> 
> As I said in my proposal, I'm not keen on new reserved names either.
> But I don't see a better alternative.   What goes on inside your
> "use autoload"?    Where is the user-provided subroutine stored?

In the symbol table, the same way as overload subroutines, with name
similar to ")body".

> Unless it's in some user-visible variable or glob, it has to be hidden
> in some new extension to the guts.
> 
> Additionally, having a user visible subroutine makes it easy to
> export and/or inherit.

If one needs an easy way to export it, one would call the
corresponding exporting function.  Inheritance is automatic, same as
with overload.

> > But there is an additional (and separate!) callback to be called at
> > compile time:
> > 
> >   use autoload proto => whatever;
> 
> As my scheme has.    But I have one subroutine with flags where
> you have several.    I thought that would be most convenient in the
> common case where you want all the variants to do the same thing,
> i.e. load the subroutine and return the reference.
> 
> Clearly one could convert back and forth between the two styles.

No.  In my style the interpreter knows which thing is provided, and
which is not.

Ilya

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About