Hi all,
Someone recently complained about trying to debug something like this[1]:
$ perl -Mstrict -Mwarnings -E 'my $foo => 42; say $foo;'
Useless use of a constant (42) in void context at -e line 1.
Use of uninitialized value $foo in say at -e line 1.
If you're working with a codebase that doesn't have warnings, you won't
even get those warnings. You'll just get a silent, and very hard to track
down error.
When you're both declaring a variable and assigning to it, can we make
using => instead of = a syntax error? I've been bitten by this a few times
and the Useless use of a constant warning can get lost in a sea of stack
traces.
Best,
Ovid
1. https://github.polettix.it/ETOOBUSY/2023/05/16/syntax-checking/
Someone recently complained about trying to debug something like this[1]:
$ perl -Mstrict -Mwarnings -E 'my $foo => 42; say $foo;'
Useless use of a constant (42) in void context at -e line 1.
Use of uninitialized value $foo in say at -e line 1.
If you're working with a codebase that doesn't have warnings, you won't
even get those warnings. You'll just get a silent, and very hard to track
down error.
When you're both declaring a variable and assigning to it, can we make
using => instead of = a syntax error? I've been bitten by this a few times
and the Useless use of a constant warning can get lost in a sea of stack
traces.
Best,
Ovid
1. https://github.polettix.it/ETOOBUSY/2023/05/16/syntax-checking/