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. [snip] Ok, I'm convinced (mostly). I plan to do the following two things shortly (assuming they prove feasible): 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