On Tue, Mar 9, 2021 at 6:03 PM twosee <tw...@qq.com> wrote: > > 5. Not compatible with Swoole > > In my opinion, Swoole is an important part of the PHP ecosystem. But now, > Fiber cannot work with Swoole. And based on the above reasons, Swoole will > not consider compatible fiber. > > We would expect some ZendAPI rather than Fiber extensions to provide > support for coroutine switching. > > Hi Twosee,
Are you saying that by adding this Fiber code to core it will prevent Swoole from functioning? If so, that is concerning. Or are you simply saying that Swoole doesn't like this implementation and will not use it with their own code? One thing to consider when comparing the Fiber implementation is that the vast majority of PHP applications are still run behind a web server in short-lived requests. Unlike Swoole, Swow, and Parallel, it isn't limited to ZTS or CLI. It might not be the ideal solution, but IMO it is a step in the right direction for PHP to allow for better async support. And I think you are right that "Fiber is just an enhancement of Generator'', but so what? The Generator addition in 5.5 opened up PHP to a hacky way of doing async, but it worked everywhere. Fiber allows that to be much more convenient in switching contexts deep inside a call stack. I don't think it needs to be the end-all-be-all coroutine solution to rival Goroutines, and I'm pretty sure it's not trying to be. Thanks, Peter