Re: Re: PHP True Async RFC - Stage 2
| From: | Iliya Miroslavov Iliev | Date: | Thu, 20 Mar 2025 07:44:01 +0000 |
| Subject: | Re: Re: PHP True Async RFC - Stage 2 | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-126856@lists.php.net to get a copy of this message | ||
```php
await $some with 5s;
```
Maybe
```php
await $some limit 5s;
```
On Thu, Mar 20, 2025 at 9:33 AM Edmond Dantes <edmond.ht@gmail.com> wrote:
> 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?
>
--
Iliya Miroslavov Iliev
i.miroslavov@gmail.com