Front page | perl.perl5.porters |
Postings from March 2000
Re: AUTOLOADREF
Thread Previous
|
Thread Next
From:
Ilya Zakharevich
Date:
March 28, 2000 16:01
Subject:
Re: AUTOLOADREF
Message ID:
200003290001.TAA24383@monk.mps.ohio-state.edu
M.J.T. Guy writes:
> > In the symbol table, the same way as overload subroutines, with name
> > similar to ")body".
>
> Yukk! I'd regard kludgy names like as much worse than another
> special subroutine name. But that's a matter of taste.
Why? You do not know they exist until you explicitly scan the symbol
table. And you are not supposed to scan it until you are ready for
trouble.
Propose (and implement! ;-) a better scheme for inheritable overloading.
> > No. In my style the interpreter knows which thing is provided, and
> > which is not.
>
> Why does the interpreter need to know? If you don't want one
> of the functions, just make your subroutine return 'undef' in that
> case.
There are several (related) reasons, none of them decisive when
considered separately.
a) With your scheme a reference to a subroutine is returned, even if
only a prototype is needed. Thus you either insert a subroutine
in a stash, or create/destruct a fake subroutine. Both solutions
are resource hogs, one for memory, another for speed.
b) Even if you do not want to do compile-time loading, with your
scheme a subroutine call is performed for each unknown symbol (hog).
c) Your scheme does not allow coexistence of compile-time loading
with AUTOLOAD (may be desirable for incremental improvement of
the existing module).
Ilya
Thread Previous
|
Thread Next