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


Thread Previous | Thread Next
Ilya Zakharevich
March 16, 2000 12:55
Message ID:
M.J.T. Guy writes:
> > See my proposal on 'use autoload'.
> Where can I find that?    All I could find in the archives is
> 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.


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