Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:129425 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 5CE771A00BC for ; Mon, 24 Nov 2025 08:57:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1763974633; bh=j143/VBzvjl/5d8eOYvjIkxjyTDCyWFom9vIfgU3SGE=; h=References:In-Reply-To:From:Date:Subject:Cc:From; b=b4VXLhBTbHjCs/WBzYeWb9lW+xbQx/vBVO9kBTDCJQl3XrahZiCwP30BE4f4RHNeC d2LRRXQ7R8UAE/UilLfux2iSlwLrgVcXVsci3EvVyR0/3qhtWQO5wk3QO1zCxJ7jyq 8aE2QiZEfriPi3Vb+xTR15gZ3FM5jC5RoAl86R6YlAt+WKD3/ui4iJhbufA1ZjTCzd gG4p7jM4XDMwM0gLmxwdrtuW7fdcEeHL1mNfnCM1ez4h0KexB1QsI08fLd/zmqBcRU KAKba9ep+pDgqta/6asR4stu/6gITEBaT1Hk7eqavbsKdIaHQvMCI3R3oVfx3oDSJZ NBioXwy+2iAZA== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 4A9EE18038F for ; Mon, 24 Nov 2025 08:57:13 +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=4.9 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,FREEMAIL_FROM, MALFORMED_FREEMAIL,MISSING_HEADERS,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-f44.google.com (mail-vs1-f44.google.com [209.85.217.44]) (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 ; Mon, 24 Nov 2025 08:57:13 +0000 (UTC) Received: by mail-vs1-f44.google.com with SMTP id ada2fe7eead31-5dfa9bfa9c7so2810949137.1 for ; Mon, 24 Nov 2025 00:57:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1763974627; x=1764579427; darn=lists.php.net; h=content-transfer-encoding:cc:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=j143/VBzvjl/5d8eOYvjIkxjyTDCyWFom9vIfgU3SGE=; b=SlOj6vZXcXIGx5Q8Jhf3tQ0gcVmFWgfN8/myXua2AXksxkRay7iQbgq/kcBnpPI0dB we6q+I1fLm8RVIApu5MBWk0JgaCiwoH5qA4KHAsq2tlmElJZuQD4UYbR2QHY2NhDcxco 0aT1KJjHE2SvfcqT7Bf2/eJsQMQIdoGp6lG0ynzTEJr4wkW4mT9TNC39Q76EpKwlC1Bn l3dJqTwImff8Sj9rFt2jUh9KBWZBL2yestSfdeAqfZdb9N5bvgDhjscrn7vVyQt6iMA/ KeqedrLinZt+pz2nXS+HPpNBAn3FVI/MKFXuHxBkPtalViM2HylSDKYydYXrsVBitzga Luiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763974627; x=1764579427; h=content-transfer-encoding:cc: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=j143/VBzvjl/5d8eOYvjIkxjyTDCyWFom9vIfgU3SGE=; b=m4cnhwr78w+y23WmRIkivnjdd0X3zL9ycV7yDJIVUbzfp1emMfQXbI0ncwjfL5aDAq PuizGBokllvE6ZkHGk6FuESc2j6bIvsVt/vITIyeb1+TrQuqNJK95xnvFzLB0n/WS4um gy38YzRKurv4AbxjzV5d1z+zi+V83+Pzcx3vdeJ7aydJLkMeyxTsV/T2G2L3kRdJHjuK iKHzTeqD/2MNKja2C+nsuHxrYRpTXdk1Ct1BvnEch0Q2sSCTv6HTFDOECGcMLAC7l1ld Iv7C2w1pFhkCkYKakZcRO0f6qNLIh32Og7hyURXx91clcok4wIp3YApn28ydTF8jkeiC t9HA== X-Gm-Message-State: AOJu0YwNf3o7Iz4dMB9LqgtCiPjPBAakIpBU2ECUCo+DuV/yL3guV5OZ bV4FrP0cwhWKabGAM3DRPqASJvVTj9SUFMek937Xat867AipVkybaTGlNR0qsYmvMN241dKV5xP E0Ds2BNHBoT2exGu3I8dNTGniyuQi0sfHBJYu X-Gm-Gg: ASbGncvqyMB+6+erxkPww5fUqDKmJ9fnbE70uAD1IQFd+enCJKbqrTiiQq7ELBmAFc+ p+sgH9hVGr4iW/AYluRGDLDAFB6OVO/4PT38Zcz8/7xCBcJbpysgh3mAleVjx1oOcpXTGfPFH+V Xb+i8f/tG8QBFMxOQ2M82r5mmoy/YN1XsaYmvPVK6drtZPGGlRUshLOJiIhPISYDvKptk150rbF 58wHtDgXGE2BolRDqVPREpLBChUEhteLzkGO2EsXNumCR6gL+W9rco/O5hGN3/wrs16AWzH1WFk kiiExCk2/pdJxkoAPnofyrNVbgA= X-Google-Smtp-Source: AGHT+IF4/Js8tdUk+NzSv1AZ2d7QDi+neSSCQxVBOJMingM0ZvdqjMxcikchu+alM3ZsMSesB4pezPuB1VSFxdH1rzs= X-Received: by 2002:a05:6102:2d07:b0:5dd:89f2:555b with SMTP id ada2fe7eead31-5e1de3b6cc1mr3345228137.21.1763974627156; Mon, 24 Nov 2025 00:57:07 -0800 (PST) Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 References: <691963327.399484.1763796022993@email.ionos.de> <1402906904.784903.1763811759896@email.ionos.de> <2015208655.784984.1763811978476@email.ionos.de> <980296152.1071.1763813573083@email.ionos.de> <92865666.4510.1763818506332@email.ionos.de> <329450798.8037.1763822426377@email.ionos.de> <9287c46c-bc63-4dd0-9792-0f9421959589@rwec.co.uk> In-Reply-To: <9287c46c-bc63-4dd0-9792-0f9421959589@rwec.co.uk> Date: Mon, 24 Nov 2025 10:56:54 +0200 X-Gm-Features: AWmQ_bndT9g4-6ED81I1Day4p8xyhHz8vOwhdtb0fSX-nsuSHWvvYEZcoBJXGyY Message-ID: Subject: Re: [PHP-DEV] [VOTE] True Async RFC 1.6 Cc: internals@lists.php.net Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable From: edmond.ht@gmail.com (Edmond Dantes) I forgot to add an important point. If a coroutine can be started with its own separate Globals state, this means there is a technical possibility to safely run coroutines in applications with global state, guaranteeing they won=E2=80=99t break anything. If the rule of having zero Globals becomes the default rule for starting coroutines, it makes PHP potentially less dangerous. It means that data can be passed into a coroutine only explicitly at creation time, and in no other way. Of course, we need to consider the potential performance impact of this logic. But if the performance drop is minimal, this feature could potentially make the language better and essentially turn PHP into a language where global state doesn=E2=80=99t exist at all. \ After all, any code is code running inside a coroutine. That means `$GLOBALS` effectively no longer exists. Memory is always localized to the execution context. This property potentially allows coroutines to be moved between threads in the future, because the memory model begins to look like an isolated region that belongs to the coroutine. At the same time, this property **does not break existing code**, because everything remains 100% functional inside a coroutine. But now we gain the ability to run multiple instances of WordPress in a single PHP thread, if we adjust the startup code. All of this resembles Erlang and sounds a bit crazy for a PHP developer, but so far I haven=E2=80=99t been able to come up with a counterexample that would make this property negative. Let me repeat the conclusions: 1. Each coroutine has its own GLOBALS/Static, and a developer cannot pass global state into a coroutine. 2. This forces the developer to pass objects explicitly, because there are simply no other mechanisms available. 3. `static` caching breaks for coroutines. But since coroutines don=E2=80= =99t currently exist, this is not a problem. Developers will just need to account for it.