Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:128886 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 lists.php.net (Postfix) with ESMTPS id 33DF41A00BC for ; Tue, 21 Oct 2025 17:11:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1761066720; bh=quxEGXMWBo/2uffgFs0SXy7adh6YHxaCYNNEl5+n0Vg=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=KBF/LWvCp4/iiD0iReqb3shTK7Z+UWB81mj6miee6fXCgGBD6qy3IZnYwW3LZrZcP rQOjpHKdxpYjnK8TrMcNSciBaNMtOH40Bhj6Zl2D81YP5Rc7IzaEua2CbJJoVZfIG8 IRTZ/UBKK0OC81Vwo6bwhwnVtd8cp8xJFpgsf1SFAoEd+mtf4/rR99cWm5uw3zxaTa ljVbb84RUz72cKaqZg2VeGakIXnaFyrRZOkOl2ACS7/GqBQ0qiQmHednR1YHiYI635 XECCymsc8Zla0RRNc7IjZgUFOMVic12//HERqcMdROgv+ZHUkHtj0WTy6IKjggGAAQ ZVvm0jYFq/9sw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id EBA4E1801EF for ; Tue, 21 Oct 2025 17:11:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) 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, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from mail-ua1-f54.google.com (mail-ua1-f54.google.com [209.85.222.54]) (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 ; Tue, 21 Oct 2025 17:11:59 +0000 (UTC) Received: by mail-ua1-f54.google.com with SMTP id a1e0cc1a2514c-89018e9f902so3383658241.0 for ; Tue, 21 Oct 2025 10:11:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1761066714; x=1761671514; darn=lists.php.net; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=quxEGXMWBo/2uffgFs0SXy7adh6YHxaCYNNEl5+n0Vg=; b=iL2j71Mpudh+HaiCpIPJWKvaT+KVPbFduzhYJG0idaYUeF+ea/M0oF0l6huveyUCG5 5oURcIGJ2nIS1LU1srSYq2/VP5sWGtiz8SzOJoiAh5xqKPCVum6MJutifoq7KRK9eMU7 rvGbDvy/zJia6iD8tRZcB1EaW6FZA1hRYNrLnGC+Gp10mVRvR989bNuK2oXLY1EcJ1m2 ueHzKgR6L2pCWrTCBPt33TkwluiOw50f6wGCWBTVS1ttTvQvuTd7kwE3yqBRJV8n56Kt t/z52k1rq4y/4BeKCpzPzZP9lercsGyMG3vrvvSvQeiD6ThGzI8jXcJmYCToTugWST9I u0tQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761066714; x=1761671514; h=content-transfer-encoding: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=quxEGXMWBo/2uffgFs0SXy7adh6YHxaCYNNEl5+n0Vg=; b=ruVMR+pQ5z5CzVyx4eyH1SYZVrmfcGZ94psIcYNLVl8BmJJsfKd6JXU2W46i9rmB1s f3oMxPZv0S7rVrdkhLNGzPB8mRmGrZk4KyWaqz7djdLQNlDNoK9HigSWcJupQPLN5Diw RoaP2vQGOsnyeR0IrA+ViSjQlIv3atLV2LDWVBwLv5qTdsEFVcE3pLAB8e8cPLs0uW+2 pdEpursZZLEpbNaho8KT7US09p2KzEFCYOTdgkROYObqNdjr5rN2V3uPYEAkfskc8oKb roik9b3JeO/jNP95ErJvyW70vdwlPCxKpeMv3yMe/E2pAM4Se51QUAkWEiKJD5IOuD5g WBIQ== X-Forwarded-Encrypted: i=1; AJvYcCXb7WH/+BrNOdJ7ozm+ScWZpKQqK6z4cUBDjVLVHOT0RRloXBALu4ciIy4n/TNWIKYcxNveTRk/p90=@lists.php.net X-Gm-Message-State: AOJu0Yw1HPiBDU5KL1UcmhG/66a+FfrfFpl/bDa7LBKMJKMdXShkDVKC dwEk+x6JbsZ3Nh3OMYA6FXnNKv3ga8z0iTMftHpgQWsYWLBre2U7VSIRbTJM/nu3B9JoAEO6uFF NN1BsgpJXnLsd2ZlR4wOKFKUTPffSAqkDjfz8HAw= X-Gm-Gg: ASbGnctE1HpX4kDFXtL9Bce4AyAi+cKB+KMs7ed9GF899qs6yNxz+8wtRyY4BiHHSUZ QFhQgWWHcIRiVP6XXc8/eXsO1dx7vhkG0a36ai7jYkN/52XQAhH9Exes9mSL+eniQXM6MSqsOiQ P46Gir3CSfzRMjVcXEIwdzbSgwHt2oelNvlDFNyo7+WZ1OmNF8E0m9KGVOEFblZ8aVjJ0IIMxmi ecSUwORYLP0K+XRvd+m2mQ2m8ORujEchDUyCgC0MimZWdgSAFKYZoWTZ32cT1bj81zfNPr9Srku +S7IqFSp8Ap3aIj4AervzzY= X-Google-Smtp-Source: AGHT+IHWFKoLwNVz4zNw23gy+aA2wU9cmqvvS9ApoUFcxdkIZvdbtCiB4E5benRaQ6Q0X8pBhZC4U2i1VqRuHJZzRGk= X-Received: by 2002:a05:6102:e0d:b0:5d5:f6ae:38e4 with SMTP id ada2fe7eead31-5d7dd6e3eb7mr5871709137.37.1761066713924; Tue, 21 Oct 2025 10:11:53 -0700 (PDT) Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 References: <0e4e39d6-9cc9-4970-92e0-2463143b4011@app.fastmail.com> In-Reply-To: Date: Tue, 21 Oct 2025 20:11:42 +0300 X-Gm-Features: AS18NWBwy1HwrPVZovm5pLktqtKaHAkGe34UpgPiGbbcnbGbuilRFVSpYK9fOf4 Message-ID: Subject: Re: [PHP-DEV] PHP True Async RFC Stage 4 To: Aaron Piotrowski Cc: Rob Landers , PHP Internals Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable From: edmond.ht@gmail.com (Edmond Dantes) Hi > Awaitables should always represent a single value. Awaiting multiple time= s should never result in a different value. Where did this rule come from? In programming languages (except Rust), there is no explicit restriction on the behavior of the await operation, nor a specific requirement that it must always return the same value. However, from a usability perspective, such a rule would make the code simpler. But... On the other hand, if we restrict the behavior of await, we fail to cover the full range of possible cases =E2=80=94 and that=E2=80=99s also ba= d. > AMPHP has a pipeline library, https://github.com/amphp/pipeline, That=E2=80=99s not quite the same. The general case of interacting with Awaitable objects looks like this: ```php // Waiting for the first event from any object in the set. // The objects in the set are of different types. awaitAny(obj1, obj2, obj3); // or All ... ``` But, programming languages don=E2=80=99t always implement this **general case**, and sometimes even try to avoid it altogether. And working with a data stream is implemented differently through `await foreach`. There is another way to solve this problem (all Futures only) =E2=80=94 through a method that always returns a new Future. For example: ```php // $queue->whenReady() returns Future object awaitAll($future, $queue->whenReady()); ``` Downside: each time we create a new object in memory, while the loop still remains. At the moment, I don=E2=80=99t see any compelling reason to impose artifici= al restrictions on behavior. * Future objects are a special case of Awaitable objects, * while Awaitable objects represent the general case. > I think you should consider additional time beyond only two more weeks fo= r discussion of this RFC before bringing it to a vote. > PHP 8.6 or 9 is some time away. This is definitely not an RFC to rush to = voting. I have no objections. Thank you, Ed