Re: [VOTE] True Async RFC 1.6
| From: | Bart Vanhoutte | Date: | Tue, 25 Nov 2025 12:15:13 +0000 |
| Subject: | Re: [VOTE] True Async RFC 1.6 | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-129453@lists.php.net to get a copy of this message | ||
Op di 25 nov 2025 om 12:54 schreef Rob Landers <rob@bottled.codes>:
> ... Adding an "async" to the function makes it return a Coroutine, that can be
> awaited.
This is just a different flavour of coloring. You would now have
functions that have "async" and functions that don't have "async".
> Then, when/if you call await on this coroutine, and we're not already in a coroutine, it
> will spawn one for us, blocking until it returns. If we are already inside a coroutine, then it
> blocks until the coroutine completes.
> Then you have coloured functions when you want them, but can call them without having to change
> your code or "infect" your code with async/await. Its literally just sugar over the
> currently proposed RFC, as you'd have to return Coroutines and await them anyway, but this is
> actually more type-safe.
At this point you need to know that a function is
async because you
need to know if you need to call await on it. Without coloring, you
don't have this problem.
Let me see if I can find some time to create some examples using
ReactPHP on Github and then we can explore some additional syntax
there to see what it would feel like as a developer?