Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:126620 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 qa.php.net (Postfix) with ESMTPS id A98851ADBDA for ; Fri, 7 Mar 2025 09:39:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1741340227; bh=Wz/oLZlORhxbWqv9KIU0rl88YIUe387+pKYm1KvNbNQ=; h=Date:From:To:Subject:In-Reply-To:References:From; b=engnLjOec+IL8EkePCx/N7ckbVfp+9LmgaWBa8BJBH05Hua9wHcruYVEHPEANpm6i tVrDFwKWt6sEclnlRLPW7nlKi297Z7ZswzPvj49DCNj++lrgTvHH8mQ82GF1n4juCX 0h/JAadmIinHBed4UnMc3M8z8fOhmBm5zikHf59V83rmGT/yo9E99Yme3UONzzyYPH Jz6ht9iMaa1OpoeutukcStwNnUubmsjuHgQ1TD2gI61mhY6QBUmLWbQZ9CT6JiZLuH AlDLL/CehxaOEDKOveKsi4YMD9rwjNHTuJTWKEd4wazPp1v+m0rebZ6Y3Cd6dOqcF6 pHVbtVUlYufjA== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 35C661801DD for ; Fri, 7 Mar 2025 09:37:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,RCVD_IN_DNSWL_LOW, SPF_HELO_PASS,SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from fout-a4-smtp.messagingengine.com (fout-a4-smtp.messagingengine.com [103.168.172.147]) (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 ; Fri, 7 Mar 2025 09:37:01 +0000 (UTC) Received: from phl-compute-11.internal (phl-compute-11.phl.internal [10.202.2.51]) by mailfout.phl.internal (Postfix) with ESMTP id 594EF1382787 for ; Fri, 7 Mar 2025 04:39:36 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-11.internal (MEProxy); Fri, 07 Mar 2025 04:39:36 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rwec.co.uk; h=cc :content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1741340376; x=1741426776; bh=gcYZvombtHx1DsFi9v/bj51y4xLlVB4TiNrd2UQ07FI=; b= EOy6IhONZvS3Gd6YG9gM2kHJeleuN7OZFbLf0cBP0y0YrqFTfHWW+fGap72t8Kba k6Xrl40l2QrHZwcejQAeW0/A+Ts6oRsUjTgjXQ4Y1fTqlHuHbCoj1TODFHmOgbuG 7tSWOLuiwzC3PcE1oHy6Im5+31Us+4a77nu6dLdhYv375WwwCh0f2+AKQuGIcW2m hiynIajz0unKgW8jhs+64rcHEXWoB50shN/LKwXZfcToqr4RbVpczZPGs2H4pAPg PnYH4z9QACRPUesGoGDMExZfwzI1tKS1xh2WsqmepTNkbpXv9cIegvVeuK/0oMOc 2wsfk4iUahY20I81EqJJ0Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; t=1741340376; x=1741426776; bh=g cYZvombtHx1DsFi9v/bj51y4xLlVB4TiNrd2UQ07FI=; b=EqsOW+l4HaCL6XpdJ YSZf3qboaEtaIWDi/ZCCikPS4aDh9uyL3DiFJHac26F9jEmXy2q79ncBPtjHOZVr IKPJhaWxAhogIG0vPKhuX0NsD3k9c04XPkK8PqpGMBqhJoGrriexghhaLKaXzCTb MhESEIr412E1tSDG9PGYEleoDMxrihT60W3x3yK0Yl/e6YI3XnAs3MUNaYeRUCCr +Gbi8hqg86HOfoMsypo/ZAEgtG+BQkQJxroXJ8LmIFeHzXN/wbvpyTLBERCrtf7q wWLCGStXahyOv6LDtfAaKQx36T9bZe52jKiqwKgKKgig1sTqqBB04afMSfW64ma3 clxHQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdduuddtfedvucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggv pdfurfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpeffhf fvufgfjghfkfggtgfgsehtqhhmtddtreejnecuhfhrohhmpedftfhofigrnhcuvfhomhhm ihhnshculgfkoffuohfrngdfuceoihhmshhophdrphhhphesrhifvggtrdgtohdruhhkqe enucggtffrrghtthgvrhhnpeehleffteeigfevudetfedugedtudevledugeeugeelheei hfehgfdtkeevvefgleenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrih hlfhhrohhmpehimhhsohhprdhphhhpsehrfigvtgdrtghordhukhdpnhgspghrtghpthht ohepuddpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepihhnthgvrhhnrghlsheslh hishhtshdrphhhphdrnhgvth X-ME-Proxy: Feedback-ID: id5114917:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Fri, 7 Mar 2025 04:39:35 -0500 (EST) Date: Fri, 07 Mar 2025 09:39:33 +0000 To: internals@lists.php.net Subject: Re: [PHP-DEV] PHP True Async RFC User-Agent: K-9 Mail for Android In-Reply-To: <08c8ad0b-e8f4-46e3-99f0-b80748d40b89@app.fastmail.com> References: <9964db8c-0ffe-43d5-8246-47fc76b07180@app.fastmail.com> <78a03dd0-fd4a-4f4a-ad8a-37e5704f06fc@app.fastmail.com> <08c8ad0b-e8f4-46e3-99f0-b80748d40b89@app.fastmail.com> Message-ID: <07973EAE-2D83-47A8-8FA0-84286C77C02B@rwec.co.uk> Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: imsop.php@rwec.co.uk ("Rowan Tommins [IMSoP]") On 6 March 2025 19:07:34 GMT, Larry Garfield wr= ote: >It is literally the same argument for "pass the DB connection into the co= nstructor, don't call a static method to get it" or "pass in the current us= er object to the method, don't call a global function to get it=2E" These = are decades-old discussions with known solved problems, which all boil down= to "pass things explicitly=2E" I think the counterargument to this is that you wouldn't inject a service = that implemented a while loop, or if statement=2E I'm not even sure what mo= cking a control flow primitive would mean=2E Similarly, we don't pass around objects representing the "try context" so = that we can call "throw"as a method on them=2E I'm not aware of anybody com= plaining that they can't mock the throw statement as a consequence, or want= ing to work with multiple "try contexts" at once and choose which one to th= row into=2E A lexically scoped async{} statement feels like it could work similarly: t= he language primitive for "run this code in a new fiber" (and I think it sh= ould be a primitive, not a function or method) would look up the stack for = an open async{} block, and that would be the "nursery" of the new fiber=2E = [You may not like that name, but it's a lot less ambiguous than "context", = which is being used for at least two different things in this discussion=2E= ] Arguably this is even needed to be "correct by construction" - if the user= can pass around nurseries, they can create a child fiber that outlives its= parent, or extend the lifetime of one nursery by storing a reference to it= in a fiber owned by a different nursery=2E If all they can do is spawn a f= iber in the currently active nursery, the child's lifetime guaranteed to be= no longer than its parent, and that lifetime is defined rigidly in the sou= rce code=2E Rowan Tommins [IMSoP]