Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:128851 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 D2B751A00BC for ; Thu, 16 Oct 2025 07:38:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1760600305; bh=3qMzWYcRwsaMO7fnAXiBztfC6dokNCMcd/XODSZ8mG0=; h=References:In-Reply-To:From:Date:Subject:To:From; b=GX9yeh7VdaeXUFcyFNpR+229F+7DlX/1I7yxNaiY28F1IimXQYoWbKuIi9Jbi0+Wm bdCEMwGMFl7V6qzTiTy7vU1T3xjnKUCBQLozfbhrsXOTukITzSDwdTR0Ir+l1WuZsg JhSz3LVWJyUN2jNI1EM8XgdBkMtX/oMJuqLWMqGqA/Q3aSiNsXUMRvA+pH+mBY5FZu bN7p/T44+GaKqT5QTHUCzodPjXiSmw/AEv5rNsI6uH+gn+1oNWSffyhLMdqIWxxGk2 7QlArervvRV0OpkqIe8Eus53Xz472USKAT0f+46ONSdiawePKZjlZZarCAE+2GJGfZ NSV1zIFG5MgVA== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id ABCAB1801EE for ; Thu, 16 Oct 2025 07:38:24 +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, HTML_MESSAGE,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-wr1-f42.google.com (mail-wr1-f42.google.com [209.85.221.42]) (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, 16 Oct 2025 07:38:21 +0000 (UTC) Received: by mail-wr1-f42.google.com with SMTP id ffacd0b85a97d-427015003eeso135606f8f.0 for ; Thu, 16 Oct 2025 00:38:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1760600295; x=1761205095; darn=lists.php.net; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=3qMzWYcRwsaMO7fnAXiBztfC6dokNCMcd/XODSZ8mG0=; b=B2OiFtF+W1LyldxPjN+hOnsjdP8/yTLBXLAuOR/28NKSAXd01Ynhv8UrEUHpQQGXk3 8hSgSF84tcvnWEDXWACyioZPh2T7ROqYpgHWc6O5YZLYVd7DS8xDCzDD9lcUUcz1EVOx Pjlh95mC3aEl2kHcKgFsewlK78JZ1mvpY3kjBDT5HFHhq9NbGaQvoKMNH5ek5959VwN5 aTwHVeoqUkISik6jzqba2ibhXwPNIKSsH7OusjqGz4etBKdv8ic2FhO6bZTXZP5xDRjg uN9xzRCNX1UfidEfg+OyRrcrUYxPd4Cvs7vNmvNzTn1jj/el3wchPSWCvev4VYqvqGwE VW1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760600295; x=1761205095; h=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=3qMzWYcRwsaMO7fnAXiBztfC6dokNCMcd/XODSZ8mG0=; b=olr9jN46yEySmHnXvQdNdgRV09K6R0/CXfuCCVMuEdnVdgcvfG+Qv5tR+lnvGd6gFb eIp35HFEMrV7M+qTRI2DtL2VtNFf5q4Y56+xLkZ5UnCohLLlEQtamd/nUcsFjyRYxf4t LZhnlmCONRD19LU3bCQgmSzodUJJfdWvKB+a9tXfvk+D2Ici7Hr1b2Me4kt9bQCZi6ZG klCsA9QQKGq/C+R41D/oR5eGQoydwWvwnfyVTHqflEWh+KZkEYbF0ibrXsnhormdT4+p lwKaby2NIz2M4mOhkkIP3Q60S2i6iS47jyzJn26epoWjgI7APu3sJAeAljJYA2DUaxip 8kUQ== X-Gm-Message-State: AOJu0YyU3SLyvPu7unjsyJDmwP5d7W4p/yI15MWYp70e1KDMcO8EeV76 AZUV/xtFGnVujuPzJHgLkfgfkYSdK6J1OGNm1l8Bgccxlo/hICaZo4F+6u1ZC4VDaOiI0afhgi1 ZAlZ/k7Q6lRNxhx3rbSkdRGxoPw9dvy6c8Q== X-Gm-Gg: ASbGncul+l5DFDd/AgaYk8+fKcwBvgJYuGP9ymQNRFw6H7zNiENEC8Lvrc3BB6tPkeH HeLpPbP8ZCIMFvU9i0kkjMo87+yI7xTk+jeTMgGJNZmXPlI/ThTnmyNCUb9+nIwaSDNSperI8/f Zwoo19DrIft5kNPlpbStf8HFAkWh9Jvo6OTA9dDkm7sph5SNK5rKRUOuhlXe0ho/fZB+0y+MbaB XCzydam1aWDsTeg/C6izs3Sfg6aCYLfwW7ZYrxRZQBXnrixS+I4/XpAV6cpGYRY4cZkyOxZpSeT BgF9I7pl3E/xotWD0cR0VkBS X-Google-Smtp-Source: AGHT+IH0k7qjeVMjTu7Upu6e2gi2Rf26P1Kzl+4iVXpsoksGEDzOedQAopjkbHEeutVFeuIvOQBfMQ95Vd0twgCKd2U= X-Received: by 2002:a05:6000:2303:b0:425:72f2:f872 with SMTP id ffacd0b85a97d-4266e7dfe00mr20611223f8f.31.1760600294847; Thu, 16 Oct 2025 00:38:14 -0700 (PDT) Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 References: <2b9fd3ec-50ca-41e4-985a-274f886df8b3@app.fastmail.com> <2e39e211-c816-41db-a079-f2c6b3934e0a@app.fastmail.com> In-Reply-To: <2e39e211-c816-41db-a079-f2c6b3934e0a@app.fastmail.com> Date: Thu, 16 Oct 2025 09:38:01 +0200 X-Gm-Features: AS18NWBUorekHwJtBcIFjowkjRqkGcAqkpAh50KCO1sB1FEA4BSe6UaZVHNlJcM Message-ID: Subject: Re: [PHP-DEV] PHP True Async RFC Stage 4 To: PHP Internals Content-Type: multipart/alternative; boundary="0000000000002a78f7064141b38e" From: daniil.gentili@gmail.com (Daniil Gentili) --0000000000002a78f7064141b38e Content-Type: text/plain; charset="UTF-8" > You've provided examples and said that it violates design and fundamental elements, but not which design and fundamentals, ie, the evidence for the decision. I would expect more than "because I said so" for such a huge language feature, but rather arguments grounded in computer science. He very explicitly described the issue, in objective terms: a breach of agreement in the context of the invocation of a foreign interface. In simpler terms, you can't and should not be able to mess with the internals of code you didn't write: this is similar to the principle of encapsulation in OOP, where you cannot modify private properties of an object. Cancellation should be part of the contract of an async function: it is safe, and most async languages already implement it explicitly by passing a context or a cancellation token, the current approach of the RFC does it implicitly, which is also fine. Awaiting for the completion of spawned coroutines should *not* be part of the contract of an async function: it is an incredibly easy footgun, as it's incredibly easy to spawn a coroutine meant to i.e. run until the object is destroyed, and then encounter a deadlock when the linked scope is awaited for before the object is destroyed (even messier if cycles and thus the GC are involved). Languages like Kotlin that do implement await on scopes have already realized that it is a mistake, as can be seen by the many warnings against using await on a scope, as I already linked in previous emails. On the other hand, making the same mistake described above, by cancelling a scope, will produce a very easy to debug exception instead of a deadlock, easily fixable by (warning the author of the library class) to use a new scope to spawn coroutines within the object. Awaiting a scope leads to deadlocks in case where a separate scope is needed but not used, cancelling them leads to a simple exception. Awaiting on multiple tasks can already be done, explicitly, with TaskGroup. Regards, Daniil Gentili. --0000000000002a78f7064141b38e Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

> You= 9;ve provided examples and said that it violates design and fundamental ele= ments, but not which design and fundamentals, ie, the evidence for the deci= sion. I would expect more than "because I said so" for such a hug= e language feature, but rather arguments grounded in computer science.=C2= =A0


He very explicitly described the issue, in objective terms: a bre= ach of agreement in the context of the invocation of a foreign interface.

In simpler terms, you can= 't and should not be able to mess with the internals of code you didn&#= 39;t write: this is similar to the principle of encapsulation in OOP, where= you cannot modify private properties of an object.
=
Cancellation should be = part of the contract of an async function: it is safe, and most async langu= ages already implement it explicitly by passing a context or a cancellation= token, the current approach of the RFC does it implicitly, which is also f= ine.

Awaiting for the co= mpletion of spawned coroutines should *not* be part of the contract of an a= sync function: it is an incredibly easy footgun, as it's incredibly eas= y to spawn a coroutine meant to i.e. run until the object is destroyed, and= then encounter a deadlock when the linked scope is awaited for before the = object is destroyed (even messier if cycles and thus the GC are involved).<= /div>

Languages like Kotlin that do implement await on scopes have already= realized that it is a mistake, as can be seen by the many warnings against= using await on a scope, as I already linked in previous emails.

On the other hand, making the sam= e mistake described above, by cancelling a scope, will produce a very easy = to debug exception instead of a deadlock, easily fixable by (warning the au= thor of the library class) to use a new scope to spawn=C2=A0coroutines within the object.

Awaiting a scope leads to deadlocks in case= where a separate scope is needed but not used, cancelling them leads to a = simple exception.
Awaiting on multiple tasks can already be done, explicitly, with TaskGr= oup.


Regards,
Daniil Gentili.
--0000000000002a78f7064141b38e--