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

Re: PROPOSAL: my $x if $false; and lexical initialisation

Thread Previous | Thread Next
From:
Dave Mitchell
Date:
March 2, 2003 05:16
Subject:
Re: PROPOSAL: my $x if $false; and lexical initialisation
Message ID:
20030302131315.B26339@fdgroup.com
On Sat, Mar 01, 2003 at 04:29:26PM -0800, Gurusamy Sarathy wrote:
> >Another option would be to insert an OP_STARTMY after each nextstate
> >that preceeeded a my declaration ???
> 
> Seems kludgey for the cases where there is no nextstate preceding
> the padsv.

....

> 
> Another way to approach it is to separate out the OP_PAD?V ops
> and move them to execute at the beginning of the statement, sort
> of as a preamble.  This means transforming:
> 
>     my ($x, $y) = ("xxx") if $z;
> 
> into the approximate equivalent of:
> 
>     my ($x, $y), (($x, $y) = ("xxx") if $z);


Don't both these two approaches have roughly the same effect - ie they are
both migrating the 'intro' actions to the start of the statement
containing the my? Although presumably your approapch involves
maipulating the parser while mine involves the peephole optimiser?


-- 
"Strange women lying in ponds distributing swords is no basis for a system
of government. Supreme executive power derives from a mandate from the
masses, not from some farcical aquatic ceremony."
Dennis - Monty Python and the Holy Grail.

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