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

Re: optimization idea

Thread Previous | Thread Next
From:
Elizabeth Mattijsen
Date:
October 25, 2004 13:23
Subject:
Re: optimization idea
Message ID:
f06110402bda2fcbc02b9@[192.168.10.93]
At 5:10 PM -0500 10/21/04, David Nicol wrote:
>when a lexical variable is not written to between getting assigned
>from a constant and getting interpolated, replace the value in the
>string at compile time
>
>example:
>
>sub statename{
>    my $name = 'david';
>    return "hello my name is $name";
>}

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";
}


Liz

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