I was surprised when I first learned of this. I'm not sure why they didn't just fix the bug, so that
my $foo = "foobar" if $bar;
would be equivalent to
my $foo;
$foo = "foobar" if $bar;
Or, I'm not sure why they didn't fatalize the syntax, regardless of the value of $bar. Today $bar == 1 and your code works; tomorrow $bar == 0 and you get a fatal error?
I'm sure there's lots of code out there using the deprecated syntax.
This syntax had a bug. The variable did not get garbage collected when it fell out of scope. Perhaps the decision to fatalize it was a practical decision to fix that bug.
Probably it was too hard to just fix it, so fatalizing it was the next best thing? But it seems very risky/buggy to fatalize only in the cases where the conditional expression is false, since that expression is not a constant.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I was surprised when I first learned of this. I'm not sure why they didn't just fix the bug, so that
my $foo = "foobar" if $bar;
would be equivalent to
my $foo;
$foo = "foobar" if $bar;
Or, I'm not sure why they didn't fatalize the syntax, regardless of the value of $bar. Today $bar == 1 and your code works; tomorrow $bar == 0 and you get a fatal error?
I'm sure there's lots of code out there using the deprecated syntax.
This syntax had a bug. The variable did not get garbage collected when it fell out of scope. Perhaps the decision to fatalize it was a practical decision to fix that bug.
Probably it was too hard to just fix it, so fatalizing it was the next best thing? But it seems very risky/buggy to fatalize only in the cases where the conditional expression is false, since that expression is not a constant.