in reply to Re^2: Curious result of using "my ... if ..."
in thread Curious result of using "my ... if ..."
5.10 throws a warning for that type of constructNo it doesn't. I seem to recall that blead did, at some point, but it appears to no longer do so.
I constantly wonder why it is not an error at all. Whatever its behaviour could be in an actual implementation, I can see no logical nor intuitive semantics that could be attached to the construct. It has a meaning to do something upon a condition. How can have a meaning for a thingie to exist or not, upon a condition? Point is, declaration happens at compile time, condition is verified at runtime. "Ideally" one could expect that in statements following
my $var=whatever if condition;
$var would be the lexical one just declared if condition is true, and something else (as if the declaration just were not there) otherwise: clearly, any way you look at it, it's unsatisfactory.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Curious result of using "my ... if ..."
by jdporter (Paladin) on May 16, 2007 at 14:35 UTC | |
by blazar (Canon) on May 16, 2007 at 15:02 UTC | |
by jdporter (Paladin) on May 16, 2007 at 16:06 UTC | |
by blazar (Canon) on May 16, 2007 at 19:06 UTC |