Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:128838 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 1D63C1A00BC for ; Tue, 14 Oct 2025 16:19:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1760458790; bh=bZNykWH4jhRD0gcXm4jhM2o5ehJsKP/Wnydi2l5xia0=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=jRfXWDcxAm7B4K5caYUOP4sXr+AAjVSW6NnMrx/QR9iNv2E3nNGEIGw6EYLNDQTzI 479HQlszOYO7FSWatoSpw3udmu24LJGlBkEx60esaYjpJVPccp2qAubir1rnK4VlX2 xenztFei26h/cBHz0k1uUf+XIkaxDk/Hs1NJWe4B9GZUFGjhycpNFSF+uEx2nGegU3 /QKyTqdE0790gQ1mpz75GRzyhwEg6dZWSaIsnX4f4lSyirpZw5cv62hT8FMexGen6f ajl3QVVsH2fFZPKPJulARo1Drjma7NhS0Bs7Qw0KFidJEu89+5kHyGTBAHqf7n5xaj 2ikbUYY2MgM2w== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 028791801E5 for ; Tue, 14 Oct 2025 16:19:50 +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_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-f52.google.com (mail-vs1-f52.google.com [209.85.217.52]) (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, 14 Oct 2025 16:19:49 +0000 (UTC) Received: by mail-vs1-f52.google.com with SMTP id ada2fe7eead31-5838680e242so1636715137.0 for ; Tue, 14 Oct 2025 09:19:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1760458784; x=1761063584; 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=cSQGNuSAGWkE315ibLROhTJWljRimCZCbsgpwEeVp0I=; b=fPyjAUVrxWCLaBU/L2oH99vgIMsSzfpy+lbbaKudlgIELF9aFaweXx24N05SHLAkUP L81IcB29VHj2L7Qbq1Wuwdc9bqEY1jLdYsUrKdSiG1LVm7u/ekV8IzCnLbohOTXs6J/m 7eIYbDkmVTUmKz2WlyeXHSr2LiWHaUF1wwDLq3PGaTgIkuJAV3oOn+ZIkQ54mviqTvFy A0j5o7M/sDvPO/nOSb04upAi4/Di00ZjFlwRwi9KslqPq8NAfP8e9UNlWQhQ7xpTsjZ7 cxKqlq3yfJy3LHENZ2+QHHuTHaidL1R1gLQtK+qfBp0Zj5eqkJCX1m8q3lCFWruO3wH/ D9nQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760458784; x=1761063584; 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=cSQGNuSAGWkE315ibLROhTJWljRimCZCbsgpwEeVp0I=; b=AyZ/yAj95lal1JUK8eL8Pgo8y2ANLTcpZX9nVwUQrx5bhIwe9k6mNkBR4/Ch3AjQMU kXY/SkCWu6+urVfu7R40fHeAbgyvxFipSxlHrg8oZNjA0/GJYFVJRZ6vXeL6AzeKrrVV kgEfmQv/1ObRzJYf9hF3rmTWhZHK1Miwc7trA4LN3k1xMYyjzkuE/C3+iu3GqKtyc4rZ DXX2PqIq2OzEgyY2dL1KgG0xekt9Tb1PjCd79oxYefwHzMlE/fMlL6JYL2UMLADBkXWv Taw5NbCy35kSLo+pHbScgya1JXYA+qWNoXUhS/8VX43brwZCHz2UdCGoFyGyhTDlnQCm B9HA== X-Gm-Message-State: AOJu0YwEM2vvAvMnf0bQaAVEYiOiE1LjwnGMS0Q3LK0ec57LCnqzwIMW ZM7as5VynKJFXEdjRD3X2aCsPV9DAsMjoy3EX7YN+BN9yAHvsanAVHsziv1xurIzROOTC5F6aIr fXrN+noPQn3aLkLE3ZDgeYIyNaiDXQd5a7GmncAg= X-Gm-Gg: ASbGncsF0TnaWrqN7Tt+zB9tqZB4xSTlB419PkpJwS+dEFzCNDTE1rRJIFxsSfk87ka m8qSuqYSn+hlOfUcU3WA0SZJLb3oD6FqwjcZElKsa8JidXPOodBGBxkEmYAceJ7UxBqxes77oGh hUL0GffK7VTgT5jphnLGl34920rzIWliXdV4QZ/j4Rw0GCV+Z6r9qDNIfSBhcvygn60EvlcPSk9 TeudbJlnuDMkq/peug916GIAS5jXktSwNO4Bh47XYS0+cHmvUbXBwNZ X-Google-Smtp-Source: AGHT+IG1UN+0rnskNLRpQuwFdK40GKaDckvYDvxE+EyDKNNDYsUkLBhdwOrKlmnLaxNHa+cMq1eJtbxWx72PnuHG9y4= X-Received: by 2002:a05:6102:32c1:b0:54e:76ce:8fb5 with SMTP id ada2fe7eead31-5d5e2271ac7mr8450591137.9.1760458783618; Tue, 14 Oct 2025 09:19:43 -0700 (PDT) Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 References: <14f591d4-aa1e-49dc-bc20-03cb493dc20c@app.fastmail.com> <4f9b8dfd-5415-3df3-fda9-33a8716c57c1@php.net> In-Reply-To: Date: Tue, 14 Oct 2025 19:19:32 +0300 X-Gm-Features: AS18NWAbQoDyac3EHznguCAnGq8dHy23XV-1dk_KXF1EqomS0o2eQFVX5Pheha8 Message-ID: Subject: Re: [PHP-DEV] PHP True Async RFC Stage 4 To: Larry Garfield Cc: php internals Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable From: edmond.ht@gmail.com (Edmond Dantes) > It's vastly improved from the first version back in the spring, but there= are still numerous footguns Which specific footguns? $scope var? > Mainly, we should not be allowing anything but structured If you always follow the =E2=80=9Cnursery=E2=80=9D rules, you always have t= o define a coroutine just to create a nursery, even when the coroutine itself isn=E2=80=99t actually needed. That=E2=80=99s why we end up with hacks like =E2=80=9CTask.detached.=E2=80= =9D (*Swift*). And *Kotlin* keeps trying to invent workarounds. **TrueAsync RFC** takes a different approach and gives the programmer maximum flexibility while still complying with every principle of structured concurrency. At the same time, the programmer gains two styles of structured concurrency organization, one of which fully matches Trio. > I very much want to see it evolve further in that direction before a vote= is called and we're locked into a system with so many foot guns built in. Such an approach would require more changes to the code, and I don=E2=80=99= t see how it would protect the programmer from mistakes any better than this RFC does. Of course, the with-style syntax would allow for maximum safety when working with tasks, but that=E2=80=99s not an issue with this RFC. The **Trio** model is not perfect; Kotlin and other languages do not adopt it (maybe by accident =E2=80=94 or maybe not). It=E2=80=99s not suitable for all types of tasks, which is why the criticis= m is valid. Although Kotlin is criticized for storing Scope inside objects like: =E2=80=9CLong-living CoroutineScope stored in objects almost always lead to resource leaks or forgotten jobs.=E2=80=9D However, there is no other way to solve the problem when coroutines need to be launched within a Scope gradually rather than all at once. But... Ok... ```python async def background_manager(): async with trio.open_nursery() as nursery: while True: event =3D await get_next_event() nursery.start_soon(handle_event, event) ``` ^^^ The example of how the pursuit of an =E2=80=9Cideal=E2=80=9D ends up produc= ing ugly code. My position is this: **TrueAsync** should support the best patterns for specific use cases while still remaining convenient for the majority of tasks. The fact that certain tools require careful handling applies to all programming languages. That doesn=E2=80=99t mean those tools shouldn=E2=80= =99t exist.