On Thu, 18 Jan 2018 02:55:58 +0000 Zefram <zefram@fysh.org> wrote: > Paul "LeoNerd" Evans wrote: > > optree = (*PL_sub_body_hook)(aTHX_ optree); > > That sort of hook seems dubious. Blanket application to all subs > makes it tricky to implement any targeted effect, and giving the hook > only the optree makes it fairly limited in power. Yes; agreed it's a bit scattergun while at the same time not being generally useful enough. > >able to suggest a different method I can let my users have `async > >sub`s with signatures? > > Do it the other way round: your code should control the top-level > parsing and treatment of ops, and call into the core parser to parse > the specific parts of the standard syntax. You want a signature > parsing API function [perl #132474], and a similar API function to > parse attributes (for which you should open a ticket). I did consider that way, but then I'm always playing catch-up with the perl API, and in effect my code starts to contain larger chunks copy-pasted from perl core internals so I can orchestrate those same functions in the same sequence as core does. Plus it can't help me on 5.20 to 5.26 at least, so there'd be a gap. I'm going to experiment with hooking the opchecker for OP_LEAVESUB to see if that's another way to implement this. If that works, then I'll probably stick with that instead of my current attempt, because then it automatically works for 5.20 to 5.26, in addition to whatever future perl version eventually provides direct parser APIs for signatures or attributes. -- Paul "LeoNerd" Evans leonerd@leonerd.org.uk | https://metacpan.org/author/PEVANS http://www.leonerd.org.uk/ | https://www.tindie.com/stores/leonerd/Thread Previous | Thread Next