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

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

Thread Previous | Thread Next
Dave Mitchell
March 2, 2003 05:16
Re: PROPOSAL: my $x if $false; and lexical initialisation
Message ID:
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 Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About