develooper Front page | perl.perl5.porters | Postings from September 2014

Re: [perl #122661] Documentation "The Ellipsis Statement" of perlsyn

Thread Previous | Thread Next
From:
demerphq
Date:
September 13, 2014 13:41
Subject:
Re: [perl #122661] Documentation "The Ellipsis Statement" of perlsyn
Message ID:
CANgJU+USkSnA8MON5529Bki2o4uj1GoxiwCmLrhX4_Q+09fn2A@mail.gmail.com
On 3 September 2014 06:50, Eric Brine <ikegami@adaelis.com> wrote:

> On Tue, Sep 2, 2014 at 9:31 PM, Ricardo Signes <perl.p5p@rjbs.manxome.org>
> wrote:
>
>> I am somewhat baffled, as I have never seen "put semicolon at the end"
>> used for
>> this purpose.  It didn't work in v5.12.5.  I think this is probably just a
>> documentation error, plain and simple, yes?
>>
>
> Correct. Documentation error.
>
> Nothing to do with "..."
>
> >perl -e"map { 1, $_; } @a"
> syntax error at -e line 1, near "; }"
> Execution of -e aborted due to compilation errors.
>
>
I think you could argue this is a bug too, although in the same category as
this:

perl -le'map { no warnings; $x++ } 1..10'
"no" not allowed in expression at -e line 1, at end of line
BEGIN not safe after errors--compilation aborted at -e line 1.

That is the parser thinks the open { is the beginning of a hash constructor.

This works:

perl -le'map {; no warnings; $x++ } 1..10'

because the {; tells the parser early enough "this can't be a hash
constructor".

Personally I would love to see a "once and for all" fix to this class of
stupid.

Yves

-- 
perl -Mre=debug -e "/just|another|perl|hacker/"

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