Re: add Fiber (sackful coroutine) support

From: Date: Sat, 09 Sep 2017 10:12:51 +0000
Subject: Re: add Fiber (sackful coroutine) support
References: 1 2 3 4 5  Groups: php.internals 
Request: Send a blank email to internals+get-100485@lists.php.net to get a copy of this message
> On 9 Sep 2017, at 14:27, Haitao Lv <i@lvht.net> wrote: > >> I note that the examples there all implement it not as a keyword, but as a library >> function, which maybe makes more sense: whereas "yield" turns a function declaration into >> a generator declaration, "Fiber\yield", as we might call it, is just a function call which >> can happen anywhere and manipulates some global state. > > As the Zend Engine does not offer API to pause execution, I cannot implement the await without > introducing a new keyword (just like yield). > >> The choice of "await" also feels odd: you're not awaiting the thing on the >> right-hand side of the keyword, you're sending it somewhere and awaiting something else. > > await is chosen because we cannot reuse the yield keyword. > Maybe we can choose a more proper keyword. Sorry for misunderstanding. The keyword await has been dropped and Fiber::yield implemented. Please see https://github.com/php/php-src/pull/2733

« previous php.internals (#100485) next »