Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:129265 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 7FE2B1A00BC for ; Sun, 16 Nov 2025 11:05:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1763291129; bh=1L7OEYaqCLxKFow3AKgVcuxsGm0OrVKsCFAq4PGilRI=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=DZ6ftHQhLG5B4rmwBX8rx3yGNfRhR43dcx5VyUpi7LEPeYS3NU0ksWikUXQs+2WDz 5jRyvB76YPvcSWEMoKQrgwGYyOuCo8DU9fDoQ9wSj+T3GWexZU9354LQrhq4r8r1Pr d2nVAA0z8SkW8mweBaVnPrlDZzVjemJugHgILq5ulPJOYwOogyDRxUGdwCMSunwwZd igTb9jt+2HDedAnTJpvTPJmOzu+0KBLX6jzN7S0F+GV3S6Sr0yJPlpua5WOCobqnbB KYlSHErjI+jBwZMWMNTzRPgWh4P7lMHk8v1NlISiOMcThxZw5Hy+2bgccNQvmy8gQH zPLIXqPvzurkQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 2617218054F for ; Sun, 16 Nov 2025 11:05:28 +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-f54.google.com (mail-vs1-f54.google.com [209.85.217.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 ; Sun, 16 Nov 2025 11:05:27 +0000 (UTC) Received: by mail-vs1-f54.google.com with SMTP id ada2fe7eead31-5dfd2148bf3so623326137.1 for ; Sun, 16 Nov 2025 03:05:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1763291122; x=1763895922; 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=1L7OEYaqCLxKFow3AKgVcuxsGm0OrVKsCFAq4PGilRI=; b=Bf6B51A8hY857YpP+1+60RpkbbkQExjZQbjApyYrXjqT55t1/yPN6q+mfUXUiO9Igv Cnn+8iQ/w91jrAr3q7YthgQV1mnF+ppUZav9i/netIDzoh/+Qcz3gX+34FKSENt3riNC wIO6PxQPa0BxDuqz0Vo016DDRVvP8KmMeu466o+DFHc42yOrWy0CyrVneqMPoBTxlWxm bQCK9sn0R1fmu1qwYC6Q0Ym/4dY36Vvi7f2oskq1CivioHN0XLm3iXPs/Baqe8jTAZ03 0cbvPt3HBo4Wmf86iGpLxhvDnhWRbsRyyXb7iKlGi6012fTGViaZNwphGsGm5a2hLJPP keFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763291122; x=1763895922; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=1L7OEYaqCLxKFow3AKgVcuxsGm0OrVKsCFAq4PGilRI=; b=muQTN3bcgGbfymopagYiONetZclgphX6K5VJXE2TAcRzHSd+dxLpS4sLkbRmbqFERm XmywIjFmaTEFNgI9+Ju4kaXJ2/wgAo8HNiMbUqijgI+SMD8cqwk6l+t7lx5o4qga2h9S y3fWK04xWx01HtNsVJDOQLgm9gX8RDYlwlgZwLKJ5mzLxdJocmOmt5MJ4uaJbMoc5BIn yfkZQeAJdaXQXaE1iGb3jrmERH7FaNJRpctntHpxB4Ql7EeXr8/YS6vp2NAHTwWDyELw V/RXyc22gJJZs3NBwWfJ/pETodOWOoFvlyBkc1v+s3EXkW1pdXcapvCT2UaUZucgVoVq QCCg== X-Forwarded-Encrypted: i=1; AJvYcCXZP9KDn0Imk/AD7Jmmm2aLkHEA0+AJwwlHi/PGw8ZafNjIfFVk5EYtg0dv4r+xAZ/ISCdvx580hZo=@lists.php.net X-Gm-Message-State: AOJu0Yx5BvcFU0ndtYbwo7DJCkzVqH2yonGAYpM4HE91qTK0dkHJj3Ln wqQLQysWwqqCNhKmVyjUAUT8ZH+3hajdiQbpzxl2imvmBk+E2+5oiZ2REHTd6E0vexvpWjq4jH2 jwSkAOdRwBcIDUM5wOXDSmB7JX3PX1HA= X-Gm-Gg: ASbGnctzkX/i3M0JWLKaP6HLuTFlXGe3PC5CyQMXTFfxnMxAPkUTa8+wrW1nuLeKzLp 1sVbv/ex+7gbEX/EPJRXaF1PNC93LA2gKD3B+pjybha4vxQhEcufj8pcHpuBI3zMKzzeBGD4yYi +joMFEvgszXJs5PmOF2OLUjE2vJEAiLQlMf4MR7ItPUFHD5moSedQk3vz8xF//YFNRhA2mwO+/n j17nw1ndylgxYCfIkId14Ka3W3WMPxAg2U9+00U5SBMOMhKZVNARmucl2TqQeNSq3wxw5xLwo8s 4kv1h5mDiuuJTQTH X-Google-Smtp-Source: AGHT+IGfZf5MqVU5IZ46YbwqPJhzEcUkYNfBXcu4ITUyttDbd57LAjVzFc7Ksg97HC6x5CtuJvFphhjCSQeO6VRN+O0= X-Received: by 2002:a05:6102:38c9:b0:5de:31b1:2011 with SMTP id ada2fe7eead31-5dfc5586ba0mr2843247137.17.1763291121835; Sun, 16 Nov 2025 03:05:21 -0800 (PST) Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 References: <6618a91c-5393-4f40-88b5-b5041ee09deb@app.fastmail.com> <3e0cf0a1-c1a3-4e05-97ba-0eeb7f559a53@app.fastmail.com> In-Reply-To: Date: Sun, 16 Nov 2025 13:05:10 +0200 X-Gm-Features: AWmQ_bkTDCb3DPU5gJ-OTY2R5EPMiKU6PZDvzO3itKews99smwQ3V3nOgSBH1Z4 Message-ID: Subject: Re: A Thank you (was Re: [PHP-DEV] PHP True Async RFC Stage 5) To: Rob Landers Cc: =?UTF-8?Q?Marco_Aur=C3=A9lio_Deleu?= , Michael Morris , php internals Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable From: edmond.ht@gmail.com (Edmond Dantes) Hello. > RFC authors are the subject-matter experts for their proposals, and the w= ay the process succeeds is by the author being willing to explain, restate,= clarify, and anchor concepts for people coming from different backgrounds = and > different levels of familiarity. For the discussion to be constructive, there has to be a shared desire to reach a common goal. It sometimes feels like I am the only one who needs asynchrony :) PHP does not have many options for implementing asynchrony. Why? 1. Colored functions require the language to support two runtimes. For PHP this is an anti-pattern. A single unified runtime is the key feature of the language. 2. Any code with global state inside coroutines will not behave as expected. This is not a property of this RFC but of any asynchronous code. I can add this sentence, but last time I was asked to remove wording that sounded alarming. True Async, Swoole, and Swow follow the same idea. Different implementations, but the same logic. AMPHP and React differ only in that they do not intercept PHP functions, but they still use the same technology, the same algorithms, and the same approach. TrueAsync was originally written with code from AMPHP, so you can see microtasks that AMPHP borrowed from JavaScript. Later, it adopted some techniques from Swoole. In other words, PHP has had a de facto coroutine approach for many years, but no one has ever standardized it. There is an approach and there are implementations, but there is no RFC. Do you understand why this RFC is written the way it is? Why does the RFC state that code does _not need to be changed_? Because in AMPHP and React you cannot simply take your code and run it inside a coroutine. So you must replace all PHP functions with special ones. This does not mean that a developer should forget about memory or corner cases. There is no silver bullet in programming. Do we really need to add a disclaimer under every statement that there are always exceptions? In programming, every statement has exceptions. What about colored functions. I recently explored a hybrid approach. Its logic is relatively simple. The compiler allows writing async next to a function, and then it automatically infects other functions. At the same time there is a special word noasync that prevents the compiler from automatic =E2=80=9Cinfection.=E2=80=9D Something similar can = be implemented in PHP using attributes or static analysis. This would make the code more predictable while keeping it flexible. This RFC does not conflict with that approach at all, and it can be implemented in the future if there is a desire to make the language stricter.