develooper Front page | perl.perl5.porters | Postings from February 2018

Re: [perl #132760] Blead Breaks CPAN: YANICK/List-Lazy-0.3.0.tar.gz

Thread Previous | Thread Next
Dave Mitchell
February 22, 2018 10:27
Re: [perl #132760] Blead Breaks CPAN: YANICK/List-Lazy-0.3.0.tar.gz
Message ID:
On Wed, Feb 21, 2018 at 06:56:26PM +0000, Zefram wrote:
> Dave Mitchell wrote:
> >The more I think about this, the more I think that attributes should
> >be allowed in *either* position, with a warning or croak for specific
> >attributes found in the "wrong" location:
> That would be a bad idea.

Ok, I'm convinced (mostly).

I plan to do the following two things shortly (assuming they prove

1) change the parser so that subs under 'use feature signatures' use
a different grammar rule than subs not under it - possibly by making the
toker return two different sub tokens, e.g. 'SUB' and a new 'SIGSUB'
token say, depending on whether the feature is in scope.

This will then help reduce confusing errors, e.g. this code with a syntax
error (attrs before prototype):

    no feature 'signatures';
    sub f :lvalue ($$@) { $x = 1 }

currently gives:

    Illegal character following sigil in a subroutine signature at
        ..., near "($"

It's parsing the ($$@) as a sub signature even though signatures aren't in
scope, so the error message is confusing.

2) For the signature sub grammar rule, allow it to spot attributes
following a signature and croak with a meaningful error. Which is what the
OP requested.

But Pity stayed his hand. "It's a pity I've run out of bullets",
he thought. -- "Bored of the Rings"

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