develooper Front page | perl.perl5.porters | Postings from December 2015

Re: [perl #127063] Setting $[ = 0 should not generate a warning

Thread Previous | Thread Next
Aristotle Pagaltzis
December 31, 2015 12:33
Re: [perl #127063] Setting $[ = 0 should not generate a warning
Message ID:
* Zefram <> [2015-12-29 01:35]:
> The only purpose of assigning to $[ in Perl 5 is if the code is
> actually Perl 4 code, and needs to remain runnable on Perl 4.

The only purpose of warning about `$[ = 0` is if there were plans to
change the nature of $[ in ways that make that statement not a no-op.

Otherwise there is no point in bugging users about the fact that the
programmer who wrote the code they’re using put something in it that
doesn’t have any effect (whether good or bad) but is just stylistically
discouraged by the Perl community.

That sort of thing belongs in a linter to inform the programmer writing
the code – not in a warning for the user just running the code.

Strictly speaking this is even true of `$[ = 1` but that does actually
does something so there is ever so much more of a case for a warning.

Aristotle Pagaltzis // <>

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About