Dan Sugalski wrote:
>
> At 02:52 PM 3/29/2001 -0800, Russ Allbery wrote:
> >James Mastros <[EMAIL PROTECTED]> writes:
> >
> > > Ahh, bingo. That's what a number of people (inculding me) are
> > > suggesting -- a :functional / :pure / :stateless /
> > > :somthingelseIdontrecall attribute attachable to a sub.
> >
> >The experience from gcc, which has a similar attribute, is that such an
> >attribute will be fairly rarely used and that most of your gains will come
> >from managing to teach the compiler to figure out that information for
> >itself.
> I'm hoping to have this stage of optimization in perl.
>
> Dan
define non-MY to mean, dynamic or lexical from outside of the function,
so, non-my relative to the function.
obviously_clean(\&subX){ # could be defined as:
not (any appearance of known-unclean functions)
and
not (non-MY appears at all)
}
subs and functions can get flagged clean/unclean fairly quickly then.
known-unclean are things like "rand" and any functions that have not
been marked "clean" already.
The attribute would force a non-obviously clean subroutine to be treated
as clean, and memoized, unless use-less-memory is in effect. It would allow
for some pretty subtle abuses.