F
Frank Seitz
Willem said:Tim McDaniel wrote:
) That looks to me more like a scope compile-time effect. "my $x"
) creates a variable that doesn't come into rvalue scope until after the
) end of the statement, except that it can be assigned to in the
) statement itself. (It has two different scopes? Uglier and uglier.)
Indeed. Very annoying if you want to do something like:
my $widget = $main->SomeWidget(-command => sub {
...
$widget->insert($text);
...
});
Which doesn't work (obviously, after reading the above).
The scope of a lexical (my) variable begins AFTER the expression in which
it is declared, NOT inside the expression.
Maybe this is annoying, but the rule is simple.
I don't see any "ugliness".
Frank