Re: Re: async/await - is future reserved words in PHP 7.x?
| From: | S.A.N | Date: | Wed, 04 May 2016 10:59:33 +0000 |
| Subject: | Re: Re: async/await - is future reserved words in PHP 7.x? | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-93066@lists.php.net to get a copy of this message | ||
> I think we can spoonfeed the massive undertaking a bit by spreading it
> across several iterations just to get things going. An idea I had was to
> just begin by providing coroutines as part of the language. That would
> include a
\Coroutine class, as well as await / async keywords.
> This would
> at least enable third party async libraries to be more compatible since they
> would have the same await types and semantics.
>
> The next step (or at the same time as the first) is to provide some sort of
> \EventLoopInterface along with
>
> \EventLoop::getLoop(): \EventLoopInterface
> \EventLoop::setLoop(\EventLoopInterface)
> \EventLoop::run()
> \EventLoop::stop()
> \EventLoop::tick()
>
> To start out, just provide the internal coroutine scheduler as a default
> implementation. Coroutines would use the "event loop" to schedule resumes.
>
> Doing so would allow even more interoperability if a library chose to
> implement \EventLoopInterface in its event loop, where it
> handles
> coroutine scheduling (or lets it fall back to the internal one), and could
> also provide I/O "extras".
>
> The final step would be to bring libuv into PHP, itself as a better default
> implementation of \EventLoopInterface.
>
EventLoop interface, on development stage:
https://github.com/async-interop/event-loop
PHP wrappers for libev and libeio supported PHP 7.
https://pecl.php.net/package/ev
https://pecl.php.net/package/eio
libuv - certainly better because it has everything you need and a huge
community.
Very need async/await in the PHP core (based on generators).
Perhaps there are plans in core developers, for implement async/await?