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

Re: AUTOLOADREF

Thread Previous | Thread Next
From:
Benjamin Stuhl
Date:
March 20, 2000 13:34
Subject:
Re: AUTOLOADREF
Message ID:
20000320213338.84586.qmail@hotmail.com
>From: "M.J.T. Guy" <mjtg@cus.cam.ac.uk>
>To: perl5-porters@perl.org
>Subject: Re: AUTOLOADREF
>Date: Mon, 20 Mar 2000 10:15:58 +0000
>
>Apart from the dialogue between Ilya and myself, noone has commented
>on my AUTOLOADREF proposal.    Is everyone
>
>    rendered speechless by the brilliance of the proposal?
>    rendered speechless by the stupidity of the proposal?
>    unable to see beyond the 5.6.0 event horizon?
>    gone off to work on Python?
>    still unconscious after St Patrick's Day?

Busy debating adding core hooks/source filters/embedded SQL? :)

>I'd like to hear comments from some others before I do any more on this.
>
>Ilya's and my ideas seem to be very similar, with two relatively minor
>(as I see it) differences:
>
>i)   Should there be one subroutine, with flags, (as I propose) or
>      different subroutines for the different cases (compile time versus
>      run time etc) (as Ilya proposes)?
>
>ii)  Should the subroutine have a visible name, e.g. AUTOLOADREF (as I
>      propose) or some "hidden" name containing unusual characters as
>      Ilya proposes?
>
>Opinions on these choices would be welcome.
>
>And of course, there's an opportunity for a good ding-dong battle on the
>choice of name.
>
>
>Mike Guy

I think I like the user-visible name form better, mainly because it would 
allow for nifty tricks like autoloading part of your autoloader:

sub AUTOLOAD2 {
    ... blah ...
    if ($I_need_to_load_from_the_ultimate_zipped_library) {
        *AUTOLOAD2 = load_ziploader();
        goto &AUTOLOAD2;
    }
    ... blah ...
}

Not that this can't be done with hidden names, it just requires some playing 
around with code refs:

use autoload 'prototype' => \&get_proto, 'body' => $loader_heavy;

sub get_proto {
    our $loader_heavy = load_heavy_loader; # we'll need it
    ... blah ...
}

As for a name, I suggest AUTOLOAD2, since this would be version 2 of 
autoloading.

-- BKS
______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com


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