On Wed, 13 Dec 2017 11:27:34 -0600 David Nicol <davidnicol@gmail.com> wrote: > On Wed, Dec 13, 2017 at 9:30 AM, Paul "LeoNerd" Evans < > leonerd@leonerd.org.uk> wrote: > > > most notably, the two functions with signatures > > > > static void MY_suspendedstate_suspend(pTHX_ SuspendedState > > *state, CV *cv); > > static void MY_suspendedstate_resume(pTHX_ SuspendedState *state, > > CV *cv); > > > > Were core perl to provide something of that shape (and I'm not at > > this stage requesting that it does - simply illustrating the point > > here), then my entire CPAN module becomes just another syntax hook > > using only documented APIs and features, and adds the entire > > concept of async/await coroutine-style future handling to Perl. > > > > it's easy to imagine how, given these tools, a "yield" (instead of > return) keyword could turn any sub into a coro, with no additional > complications to the programmer, as long as only one instance of a > coroutine is allowed at a time. Some additional keyword would need to > be required for multiple instances of a coroutine to coexist in the > same runtime, at least with package names for them. Indeed so. They are useful building blocks for that kind of ability. -- 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