Hello, > On Sep 28, 2015, at 3:29 AM, S.A.N <ua.san.a...@gmail.com> wrote: > > Are there any future plans for - async/await? > This need to know now, not to use these words to constants, and class names... > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php >
As a few others have pointed out, the idea has certainly been discussed, but I’m not aware of any real progress toward integrating this into PHP in the near future. Implementing async/await in PHP is certainly possible, but will be no small task. I would love to see it in a 7.x release, but I’m thinking it might have to wait until 8 just because of all the changes that would be required. I’ve created a library called Icicle (https://github.com/icicleio/icicle) that uses promises and generators to implement coroutines that use yield to interrupt execution of the coroutine until the promise is resolved. Combined with non-blocking I/O and concurrent execution implementations available in other packages designed for Icicle, you can create non-blocking and multi-threaded servers that are designed to be run from the CLI instead of the Apache SAPI, etc. If you are not familiar with Icicle, I encourage you to take a quick look at the documentation, as the proceeding paragraph will make more sense if you understand how Icicle works. I think the engine could use a similar strategy to that of Icicle for async/await. Async functions could return promises. Calling an async function with the await keyword would be similar to yielding a promise (or coroutine) within a coroutine in Icicle. If the await keyword is not used when calling an async function, this could be similar to calling Promise::wait() in Icicle, blocking control flow at that point until the promise is resolved. Perhaps in this way existing functions could be modified to support async/await while maintaining the existing blocking behavior when called without the await keyword. Aaron Piotrowski -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php