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

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

Thread Previous | Thread Next
From:
Ricardo Signes
Date:
July 8, 2012 04:58
Subject:
Re: [perl #113554] my() with empty list causes weird error
Message ID:
20120708115840.GA31663@cancer.codesimply.com
* Aristotle Pagaltzis <pagaltzis@gmx.de> [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
thought...

> 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. :)

-- 
rjbs

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About