On Tue, 20 Feb 2018 08:26:03 -0800, demerphq wrote: > On 21 Feb 2018 00:14, "Dave Mitchell" <davem@iabyn.com> wrote: > > On Mon, Feb 19, 2018 at 07:44:49AM +0000, Nicholas Clark wrote: > [snip lots of stuff about attr and sig order] > > 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: currently just :lvalue, > but potentially other attributes added later that could affect the > signature etc. > > This has the following advantages: > > 1) It allows :lvalue (and any future attributes) to be put in the > correct place. > > 2) It allows current and future code using signatures to run on perls back > as far as 5.22.0 (assuming that basic signatures don't change radically > between now and whenever they stop being experimental). > > In particular it will allow the relatively common idiom of > sub foo (....) :prototype(...) { ... } > to work in future and as far back as 5.22.0. > > 3) It doesn't need any fragile hacks like disallowing 'return' within > default signature code. > > I'm prepared to implement this if a consensus is reached (although I > suspect it may be slightly tricky). +1 > Before we say yes can you outline how one would mark an attribute as > requiring LHS usage? Specifically, how does one signal from a MODIFY_CODE_ATTRIBUTES sub that the attribute is going to install parsing hooks of some sort? I think the answer is that the module needs to be able (even at the XS level) to enquire as to whether the sub’s op-parsing has begun yet. Do we need a new API function for that? -- Father Chrysostomos --- via perlbug: queue: perl5 status: open https://rt.perl.org/Ticket/Display.html?id=132760Thread Previous | Thread Next