Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:128917 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 C14DF1A00C9 for ; Thu, 23 Oct 2025 06:42:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1761201738; bh=q2WuHjFvQqsRVp6PP5ACEw/hD894vy5tD3cRNrOIwks=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=iK/y3JHIIdRrzzD9NwORLjlOiIlEwXRjzZr3MZZUHfauguavFo0VidAdQL909Rk6+ 6lTpFIk5Vxd12yEPEJ1Stxyee0mV+qgnZT5dv4VlFJePdGqzFcNRojRzYmHfRddxYv qOq/it50X88Pp1ohtjY3NxwDKL5wrZT+EBDfmy9ulGrfu6LLwat9F0oLj0sIxgNDYA +4XQnJ7QWROc/bRfcQHv6DhDsoUWht7kDYJtP6T2K0h5VzKx5aaBpOgPGGkPEHafsN Dao+pIib3aIQcPBmEUhZrVsPd4ZlWX8hD8Uza38V+FEi4TAN6+R1UWQalpq4SisDK9 Xg0qe/ZPeE99g== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id DF4B1180388 for ; Thu, 23 Oct 2025 06:42:16 +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-vs1-f43.google.com (mail-vs1-f43.google.com [209.85.217.43]) (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, 23 Oct 2025 06:42:05 +0000 (UTC) Received: by mail-vs1-f43.google.com with SMTP id ada2fe7eead31-5a3511312d6so202908137.3 for ; Wed, 22 Oct 2025 23:42:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1761201719; x=1761806519; 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=awx2O9RlKEMKX+d2y67TpWheGHiU+qta4Mo00x1gwGA=; b=YAoZwHmtpQbh0HIXTuJ8jGvRjxpCdcDs7ObqwEbNamIj7CEFT7VDvJJ1QzBL/2u3aM nFymRMsl5+ZIRzyzIdVPmmk+eDvyYAbCP1QNKPTNmEAai6VESQozKlSbRTp8EjmML4Fz SfS/Zkp3WKq2W6yqx72Biq0WjETyscXmnD11YCgY5I7fUTrglnIMONeNCGEZ51mquAFh g1d1BN9C5KNB9/qiAGFxAWtnEDlfQQ58jcMHZamTdPAUUG6v8N/OW5JhmVDcQFGyMINr K/Da6BkQ94pOL3GcIgdN1lN0Hy+OwJg55/v9B9yUIJ0HBAfw5XEy/ZKNt9SlDLGbijD2 U76Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761201719; x=1761806519; 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=awx2O9RlKEMKX+d2y67TpWheGHiU+qta4Mo00x1gwGA=; b=aPrzTsXwTN+yknKk495ByYW0bqqxDFLhcDYYHEAFD4wWrQqK7ASI66xoGn54gHr9X7 cH8y0btml2rodW6WMOoJ5RmgsAf9p+g2S6WY+qXpUeyxoauE333KAEFw1v4ZrkJGG2pY FkeGTZZ38apkUfiwKnsT5mLIZ82e3Aorbq8n7C6yaKJYro2ewrenzczNEENOoYr6fzcA 0piVhjBmo8SYPhrtwdCia9E9AwQzg5sCrxSIlgCFW2qA6tCrnstvUX4YKWgtvmHv1QJV M0Vor9IONTkS/VxxSEbELluzCPCpLHZiDdgGuKTwaiesuEFmFPK3sE/STXfsCZQM3bap Ed5A== X-Forwarded-Encrypted: i=1; AJvYcCWf+q7P41tUQ5B/s3RXZyU/GhodDvG0CKAiiX9VVEBolim8Tdxt+m7UGs5Buz3lCJvtRbZb1B1wHxM=@lists.php.net X-Gm-Message-State: AOJu0YytGIxrClt18YRDKnnqGS6MuLZCeKbcLmxCIuf7OgK9xdaSt5Z1 v+vpN5uPAZFKWhz62QOJDEKEgL9AB2G5NiZ+1tAdK0oA9ec2ALL2H+qm3YjPeJpUY16s/Eo8+30 Jw6mCX5qRmXSds82G8JsiSRlQkM4+qek= X-Gm-Gg: ASbGncs+swZ70J34IODcJafOgC4xxfZx3MTkO/F8QJ6yJsbL6Hky7QZ8/YgMkADGs5B Kzjr9OQ4fTp+d5ejR7J9zwIk3zXNCLjjrSaT6BtmRfNdWOXJnv7ALQqUZULfbOY0ZGcTozR6U5G dZFJoKxl7Q1N6W9W8LM5tTsSblcj6NfGpo7RGn6CZFFB26qHDSZJACpffgy5lknCnQ6oLes18Wy Xd0MMkWGKTGUHV9GzWOcX/Lwj4M3FcuzAQMGd8afb41g7gXbZc6OfLzJDCcF7Dj2N6CWw9iPsVS AhQycfJ2rNmQ/gIeHgHgf99kxg== X-Google-Smtp-Source: AGHT+IEeKUhhrf7zx0EO9l77X0ZJLEE/tgBrJz3YTbSQUK66SfZXiC7ApsjOMrg7b8VupawFm7WC58OfljUq0AY6w9U= X-Received: by 2002:a05:6102:a48:b0:524:2917:61a9 with SMTP id ada2fe7eead31-5d7dd6d9584mr7892802137.34.1761201719460; Wed, 22 Oct 2025 23:41:59 -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> <37180d8d-85b4-49a3-a672-334bf4329470@app.fastmail.com> <2f8524a7-dea2-4fbf-933a-c538d3706253@app.fastmail.com> <151800a7-1094-49bc-8e43-c593a74741af@app.fastmail.com> <772a457f-69b6-4a76-8224-081917d719f6@app.fastmail.com> <8c20e8cc-cec7-4aa5-b6a7-663ef8159e1a@app.fastmail.com> In-Reply-To: <8c20e8cc-cec7-4aa5-b6a7-663ef8159e1a@app.fastmail.com> Date: Thu, 23 Oct 2025 09:41:46 +0300 X-Gm-Features: AWmQ_bkTliQnXhisvm5q_4QpZ-PfWyK8TRono-x47L0yw7iaPT-FZmhVS89id7M Message-ID: Subject: Re: [PHP-DEV] PHP True Async RFC Stage 4 To: Rob Landers Cc: Aaron Piotrowski , PHP Internals Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable From: edmond.ht@gmail.com (Edmond Dantes) Hi > Assuming an awaitable is idempotent (such as the result of a coroutine), = this is an infinite loop. There=E2=80=99s a 99.9% chance that=E2=80=99s uni= ntended, which is part of the point of static analysis. ```php foreach(($next =3D await($awaitable)) as $value) { } ``` executed as: 1. await($awaitable) - will return some value 2. foreach got this value 3. If the value has a valid interface, then foreach will iterate over it. await($awaitable) - It always returns only one value because under the hood it works like this: ``` function await(awaitable): # 1) Create a waker for the current coroutine waker =3D Waker(current_coroutine) # 2) Register an event handler inside the awaitable handler =3D function(result, error): waker.set_result(result, error) awaitable.remove_handler(handler) # detach Scheduler.enqueue(waker.coroutine) awaitable.add_handler(handler) try: # 3) Suspend the current coroutine until resumed Scheduler.suspend(current_coroutine) # 4) When the waker is triggered, return the stored result return waker.get_result() finally: # 5) Destroy/cleanup the waker object waker.dispose() # release buffers/slots ``` > The RFC says that for coroutines, but not Awaitable. It is undefined. Sorry I can=E2=80=99t understand the meaning of this. Thanks, Ed