3 ms·
PHP is synchronous (if you dont add async extensions). How would you use async await in the language?
by omnimus 7y ago
PHP is synchronous (if you dont add async extensions). How would you use async await in the language?
- no_wizard 7y agoreactphp already fakes this with Promises, much the same as JavaScript Promises. Why not make this a genuine language construct. You can even use the async and await “sugar”. Coroutines would also be a genuine improvement
- pbowyer 7y agoIf this is something you would like to see in PHP, please have your say on the mailing list. There are some discussions, most recently https://externals.io/message/108226 https://externals.io/message/108226
- omnimus 7y agoSure there is also most notably swoole if you want async i would go all in. That said it is going to be so wierd for most php programmers you might aswell hire nodejs people and do it in node where language and ecosystem is all about async.
- no_wizard 7y agoMaybe, maybe not. The nice thing about adding constructs to a language is that you often can opt in when you do use them. Also, if you have PHP developers, its going to take less time for them to learn async constructs in a language they're familiar with than switching your entire backend to nodejs just to leverage those features. Seems to me like that'd be far more work and cost a lot more. Its not trivial to just upend an entire system.