develooper Front page | perl.perl5.porters | Postings from July 2012

Re: [perl #113554] my() with empty list causes weird error

Thread Previous | Thread Next
Ricardo Signes
July 8, 2012 04:58
Re: [perl #113554] my() with empty list causes weird error
Message ID:
* Aristotle Pagaltzis <> [2012-07-08T00:42:58]
> I find Jesse Luehr’s argument that
>     my ($foo, (), $bar) = (1, 2)
> is currently an error for no good reason convincing enough.

I had missed that until sprout mentioned it in his reply to me, and then

> Now maybe
>     my ();
> should not work anyhow, but I find that the former definitely should, no
> matter whether the latter does.

...and then, once again Aristotle convinced me of something.  This time, with:

>     $ perl -E'say for \($x,$y)'
>     $ perl -E'say for \my ($x,$y)'
>     $ perl -E'say for \()'
>     $ perl -E'say for \my ()'
>     Can't declare stub in "my" at -e line 1, at EOF
>     Execution of -e aborted due to compilation errors.

I cede that "my ();" might as well be fixed.  Those who would hate to see it in
their code can write a linter plugin. :)


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