Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:126856 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by qa.php.net (Postfix) with ESMTPS id 7D3271A00BC for ; Thu, 20 Mar 2025 07:44:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1742456505; bh=VPAaUkpRa1FGA0W1cF4b5Ql4BNNVKNcVwUmeiaaWgHo=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=h5iGywf73UigJZqnaDyPBej2MIUqcRFMkfi17c0SKmx9bx+M3fZHKoD78V3GHVtXZ 9HGouOjCqJn/gTjM0TcoRWZQb3iVvperfeu7NJs7+OYvcKPa4N++dhJvcclEEayUnC FODbguKa+OjmkYtjLZROxfzMMbUHvEm0oPKT3hlZ61/Uw7Zrj7MsfN+la2W8LEi5JH J/c73sbMYhPeYjeckZzilZ6geU5yze2G1F7RqKkIg7Cjx1hP88mKn4djVh0k4bmKzt wLQDYIMtyFgqirCoCu0URCDSqBdoFAYlVva4Vwp6i3zMfZHq+cyFPLmmv9SpVLhM02 GY+1S28QNu3ww== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 68B4118006F for ; Thu, 20 Mar 2025 07:41:44 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=0.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,FREEMAIL_FROM, HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from mail-ej1-f41.google.com (mail-ej1-f41.google.com [209.85.218.41]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Thu, 20 Mar 2025 07:41:44 +0000 (UTC) Received: by mail-ej1-f41.google.com with SMTP id a640c23a62f3a-ac2ed007aacso116675466b.0 for ; Thu, 20 Mar 2025 00:44:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1742456654; x=1743061454; darn=lists.php.net; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=VPAaUkpRa1FGA0W1cF4b5Ql4BNNVKNcVwUmeiaaWgHo=; b=blMvDPugcJ7iNZjsKUUaYJNayOKb09fSHCz10eYJhZnWKNKNXN7YaqtuNkr7k4tmND NuM9l9h9+nfR7KKOWlrnyVKzlRJVzCnDZLEWZ6FbVxxGzqT6mfkCljVC6+IqrkW7PJnT pjKux4QdLXN3pjKax45pQeu/6N7xeg3MT8Zannu8BQM8q8Ee1S70q3xmDb58QoOQoWm0 hGEdCQAl2cMm+A279FzyXpELQ9T+51NrkIs/F6493No2unM3iW18nCLBIos7CeCSmD0b m/xAuq+R/OMkscNG9lSF3oqg7iw1eWIP0vH5kep3gdSCRJqa5M7uYBDq+FhSKrBm5FoR lxzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742456654; x=1743061454; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=VPAaUkpRa1FGA0W1cF4b5Ql4BNNVKNcVwUmeiaaWgHo=; b=aJ5eYjqBlEe9KEEFPVfqYu0M4nqpATm+wOxtWL+MPOljWPNBUWID0ztauS83m6bOU/ FilpedKNksn2PaxgFkCrbIlsBuNJ2v5oOAs5oos1V5Dmup372BQjkg8I4c8fiFyA7Jss VFRjkXPXUSV5jQsW9gv79yociIfHiejQRVzrpKNCy4ioA4MSgvp/8NsZmfekcrNNERfR d5mqyCT/8PgYpFnBe9Bb9ZkCoaZs5hccETBc9q0cLadgs20C3jg7PU3Z+q0P7WAYmdp7 4ALBRecQPzWhlXVWb3Ju5sv+J0Wav9hrjqjzvFR1ZwsfcjnVXnpCDBUpfeS2FefoQF2X YFaA== X-Gm-Message-State: AOJu0YzmF5899euwqhi/j2PShepDDn0JkPeMMUf5kSyJoJ9FvIvJF1V9 AH3Pc41l4PJZ2mgV2lW6NDUu5ENr+ILPxotaOfbKOFoVQ2ogaDVHC9JSNodahtjpGaoWCp/Kw1F OLxVCbrVz1o2brIIiVhyiOLwqTP+oVFsC6rM= X-Gm-Gg: ASbGncuAnzx9BE9/mZ9aSGTQ8qyuXpj6A/bVftwYGjC5Odd6Rx2mqhj+NpdmzGJTTUv /IxczHDOYzgWwW4q5lzkVKNRAaF776mgZf44zVRBu9cJNjsw2as3R2/qkb54yTTrMmBWKeqUuhg c8AWjmAnqW+ZcYi2RbjTDvVTXQqA== X-Google-Smtp-Source: AGHT+IHkFSH/WmJUI48RmN2s7ywB7+prY4PGiJOROODgi2l/Ss7WafEycVotpHXzTAlWMOaw7ZowfRYKVwLTzLmW0Ys= X-Received: by 2002:a17:907:bc8d:b0:abf:51b7:608a with SMTP id a640c23a62f3a-ac3b7adac8emr663456466b.5.1742456653566; Thu, 20 Mar 2025 00:44:13 -0700 (PDT) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 References: In-Reply-To: Date: Thu, 20 Mar 2025 09:44:01 +0200 X-Gm-Features: AQ5f1Jo10EE5IQ9-lwlRTZidKyjKu0xthfEl7yS6FgO3aCZIUOh6AmyZfkE5RO4 Message-ID: Subject: Re: [PHP-DEV] Re: PHP True Async RFC - Stage 2 To: Edmond Dantes Cc: php internals Content-Type: multipart/alternative; boundary="000000000000df5cb20630c14dd1" From: i.miroslavov@gmail.com (Iliya Miroslavov Iliev) --000000000000df5cb20630c14dd1 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable ```php await $some with 5s; ``` Maybe ```php await $some limit 5s; ``` On Thu, Mar 20, 2025 at 9:33=E2=80=AFAM Edmond Dantes = wrote: > Hello everyone, > I=E2=80=99d 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: > ``` > [ =3D ] await [bounded ]; > ``` > > I=E2=80=99m concerned that no other programming language has a similar co= nstruct. > > 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? > --=20 Iliya Miroslavov Iliev i.miroslavov@gmail.com --000000000000df5cb20630c14dd1 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
```php
await $some with 5s;
```

Maybe
```php
await $some limit 5s;
```

On Thu, Mar 20, 2025 at 9:33=E2=80=AFAM Edmond Dantes <edmond.ht@gmail.com> wrote:
Hello ever= yone, =C2=A0
I=E2=80=99d like to ask for your help regarding the syntax.= =C2=A0

**Goal:** I want to get rid of the `BoundedScope` object whi= le still providing a convenient built-in tool for controlling wait time. = =C2=A0

To achieve this, we could extend the `await` expression so th= at it allows explicitly specifying a limit. =C2=A0
For example: =C2=A0
```php
await $some with 5s;
```

O= r a more general approach:=C2=A0=C2=A0
```
[<resultE= xp> =3D ] await <AwaitExp> [bounded <CancellationExp>];
<= /div>
```

I=E2=80=99m concerned that no other = programming language has a similar construct. =C2=A0

On the other ha= nd, if `Cancellation` is defined in a different way (not through syntax), i= t requires a separate function. For example: =C2=A0

```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
--000000000000df5cb20630c14dd1--