Re: PHP True Async RFC - Stage 2
| From: | Edmond Dantes | Date: | Thu, 20 Mar 2025 07:30:19 +0000 |
| Subject: | Re: PHP True Async RFC - Stage 2 | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-126855@lists.php.net to get a copy of this message | ||
Hello everyone,
I’d like to ask for your help regarding the syntax.
**Goal:** I want to get rid of the
BoundedScope object while still
providing a convenient built-in tool for controlling wait time.
To achieve this, we could extend the await expression so that it allows
explicitly specifying a limit.
For example:
```php
await $some with 5s;
```
Or a more general approach:
```
[<resultExp> = ] await <AwaitExp> [bounded <CancellationExp>];
```
I’m concerned that no other programming language has a similar construct.
On the other hand, if Cancellation is defined in a different way (not
through syntax), it requires a separate function. For example:
```php
await all([$task1, $task2], $cancellation);
```
This approach is actually used in all other languages.
My question is: Should cancellation have its own syntax, or should we
follow the conventional approach?