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

Alter behaviour of local($x = ...)?

Thread Next
From:
Dave Mitchell
Date:
April 22, 2003 13:51
Subject:
Alter behaviour of local($x = ...)?
Message ID:
20030422205123.GA26038@fdgroup.com
Currently, the expression

    local($x = 'bar')

acts identically to

    $x = 'bar'

ie, nothing gets localised or restored. Eg see bugid #1778 (*).

This is because the OPpLVAL_INTRO flag is set on the assign op, and
neither pp_sassign nor pp_aassign take any notice of this flag.

The options seem to be:

1) leave things as they are

2) make local($x = ...) generate a compile-time warning like
    "local() on an assignment is ignored"
(better suggestions for the wording wecome)

3) Make localisation happen.
If so, is it semanticly equivalent to
    3a) local($x); $x=...;
or
    3b) $x=...; local($x);

Personally, my vote is for (2).

Opinions, anyone?

Dave.

(*) yes, I'm so bored that I'm trawling through the bugs DB looking for
easy entertainment.


-- 
But Pity stayed his hand. "It's a pity I've run out of bullets",
he thought. - "Bored of the Rings"

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