> What lexical scope should $x be _implicitly_ declared in? Maybe, just
> maybe, we need a my $x at the top to tell us it is outside the scope of the
> first reference. Otherwise we get three different lexical variables, and an
> undefined value warning at run time.
You're right, great point. There's a lot of details implicit in the
email I sent out, which would have to be worked out.
For example, one solution might be that the default lexical scope is
only delimited on function boundaries:
# all these are in the same scope
$x = 2;
if ( $x ) {
$y = $x;
} else {
$y = 5;
}
print "y = $y\n"; # 2
sub compute {
($x, $y) = @_; # but these aren't
}
Remember, though, my() remains for use, so if you wanted to partition it
off, you could:
# separate scopes via my()
$x = 2;
if ( $x ) {
my $y = $x;
} else {
my $y = 5;
}
print "y = $y\n"; # compile error for $y
I don't intend this to be accepted without a knock-down, drag-out fight
(if at all). However, rather than just set pragmas to different values,
my point is that we shoule re-examine what the goal is, and our
assumptions.
-Nate
- Re: lexical variables made default Ted Ashton
- Re: lexical variables made default Tom Christiansen
- Re: lexical variables made default Graham Barr
- RFC: lexical variables made default (revised) J. David Blackstone
- Re: RFC: lexical variables made default (revised) John Tobey
- Re: RFC: lexical variables made default (revi... J. David Blackstone
- Re: RFC: lexical variables made default (revised) Tom Christiansen
- Re: RFC: lexical variables made default (revi... J. David Blackstone
- Re: RFC: lexical variables made default (revised) Nathan Wiger
- Re: RFC: lexical variables made default (revi... Glenn Linderman
- Re: RFC: lexical variables made default (... Nathan Wiger
- Re: RFC: lexical variables made defau... Jeremy Howard
- Re: RFC: lexical variables made ... Tom Christiansen
- Re: RFC: lexical variables m... Jeremy Howard
- Re: RFC: lexical variables made default (revi... Nathan Torkington
- Re: RFC: lexical variables made default (... Nathan Wiger
- Re: RFC: lexical variables made defau... Ariel Scolnicov
- Re: RFC: lexical variables made default (... Damian Conway
- Re: RFC: lexical variables made defau... Nathan Wiger
- Re: RFC: lexical variables made ... Johan Vromans
- Re: RFC: lexical variables m... Nathan Wiger
