develooper Front page | perl.perl5.porters | Postings from October 2004

Re: optimization idea

Thread Previous | Thread Next
From:
David Nicol
Date:
October 25, 2004 14:26
Subject:
Re: optimization idea
Message ID:
934f64a204102514254cf817fa@mail.gmail.com
okay.  so lexicals that have not had references taken from them and
have not existed
while an eval is in place in their scope
get marked as early replacable whenver they get a constant
assigned, and the flag gets cleared when 
    
     assigned to by something not a constant

      a reference is taken (or has been taken ealier in its life)

     there is an eval anywhere in the possible execution paths

it's still possible


On Mon, 25 Oct 2004 21:38:08 +0100, Dave Mitchell <davem@iabyn.com> wrote:
> On Mon, Oct 25, 2004 at 09:09:16PM +0200, Elizabeth Mattijsen wrote:
> > Wouldn't you need to add taking a ref of the var, to invalidate this
> > optimization?  Specifically for this case:
> >
> > sub statename {
> >     my $name = 'david';
> >     ${\$name} = 'liz';
> >     return "hello, my name is $name";
> > }
> 
> Then there's stuff like this, which you can't detect at compile ime:
> 
>     sub statename {
>         my $name = 'david';
>         eval '$name = "liz"';
>         return "hello, my name is $name";
>     }
> 
> --
> "Foul and greedy Dwarf - you have eaten the last candle."
>     -- "Hordes of the Things", BBC Radio.
> 


-- 
David L Nicol
transportation infrastructure technology contracting since 2002

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