Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:126588 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 7357F1A00BC for ; Wed, 5 Mar 2025 23:10:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1741216079; bh=w81MXOE5j3JnSTbOi8qwn9mA6L5I7QDl8dMMr8drzYM=; h=Date:Subject:To:References:From:In-Reply-To:From; b=SVc/oKdzvjMHWEyyIvjDkZl9mHOqHPlJCQ08jVlN4qRJSKXMYxzYcOeAQioHhrROJ NjaNwmNSzPY1Ym++farivM5z0bF/fuC7tyzSe7gtcS2dViogHZxpenYURVD2J9rg56 cbqK/+skjL8PF/nOcYoxeGcpPwzJZZZlVfAuhxpdDuKNkX2CS7kfw45QdVu/MHuzVF W5vR+f+tw8Oq7MhL7EN5yKxbsk4jkD6IRQLuSFmSKoKwlUeKxKRwCi6bIKN1HTdSh9 b153JNgF0yfCpnUW1Wtw8A9CLEZklGxXkl2BU9ab0chYTysGbtoIv0lK+LsVJfQXHz 0FNtScxkXymXg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 642CF1801D5 for ; Wed, 5 Mar 2025 23:07:58 +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 fhigh-b3-smtp.messagingengine.com (fhigh-b3-smtp.messagingengine.com [202.12.124.154]) (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 ; Wed, 5 Mar 2025 23:07:58 +0000 (UTC) Received: from phl-compute-09.internal (phl-compute-09.phl.internal [10.202.2.49]) by mailfhigh.stl.internal (Postfix) with ESMTP id 9018D25400C9 for ; Wed, 5 Mar 2025 18:10:33 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-09.internal (MEProxy); Wed, 05 Mar 2025 18:10:33 -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=1741216233; x=1741302633; bh=EDJ6mgOUzNoC0RxR12sVF13MlgAV8xMJZessdF+Qz4s=; b= nhC5u2aAvJ1vZrtAMPvtAzOpZBj6bkgQ8L6HauE+iTcslpxOq4/8SPcg+FM8GE+2 BbPiJ2AFRbvTx+NmUzfz5fgl7nu2vK6fNlm/9Iy+8kygtJtaKfqVEt8zI0LlwinX 5Ws6z/KpV9LamKk3/zgIpotF+Y73HCMPRGGtjbMaJOoyreXgVXd+aB8uOUC5A89x tJRcD5JjZo6P3h7eaaFYjqRqajNFj4VSkmsiBg3W+b5gC463jVSg8JwZdmSemGaF SZpZACCKp1HBWWcQFgpyjfwm2fRMdmbuju+g6QwtA1tWLbQCN+7oKcby/HJkYKkA iUcLtUpi1itddIF6GUWY0A== 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=1741216233; x=1741302633; bh=E DJ6mgOUzNoC0RxR12sVF13MlgAV8xMJZessdF+Qz4s=; b=FY43W176qgX8JeG5c /1XvU/EI4vG+ooqujZtSz1xMAPnP2HhFxwIun1kY/jfBZtMK3vuRj2rOpvTTGcye UkipktyHLSevqX7VH92iG1NyxZPIpwoqQlm9GSdJNtjY0iCncLu4cusuFnLC75xS GmMxS10E3RjJVLjjD5k30kroRrDKYmdPsA2ufOBMuGOkcM79X9iZ4XyipLKlf6BJ bbxZDPabuE5JvQPOzNnovkRLAyT+/BEakL8fnUr7EWvgr/HeaDZeW3IaeYI8bywd 2weegs+rjIm1TybPiU/VlwkNN0oWVPfF3aw65VcDt2Ov6HR6QtXkwhHctEPS9nIC lyOig== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddutdeiudefucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggv pdfurfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpefkff ggfgfuvfhfhfgjtgfgsehtkeertddtvdejnecuhfhrohhmpedftfhofigrnhcuvfhomhhm ihhnshculgfkoffuohfrngdfuceoihhmshhophdrphhhphesrhifvggtrdgtohdruhhkqe enucggtffrrghtthgvrhhnpeffkeevudffuddvheejvdefkeelfedtudegfeehjeduheeg ieduffeggeegveefheenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrih hlfhhrohhmpehimhhsohhprdhphhhpsehrfigvtgdrtghordhukhdpnhgspghrtghpthht ohepuddpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepihhnthgvrhhnrghlsheslh hishhtshdrphhhphdrnhgvth X-ME-Proxy: Feedback-ID: id5114917:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Wed, 5 Mar 2025 18:10:32 -0500 (EST) Message-ID: <23e162f6-54b0-4564-9d79-7b3bdc3d1ab5@rwec.co.uk> Date: Wed, 5 Mar 2025 23:10:30 +0000 Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PHP-DEV] PHP True Async RFC To: internals@lists.php.net References: <9964db8c-0ffe-43d5-8246-47fc76b07180@app.fastmail.com> <78a03dd0-fd4a-4f4a-ad8a-37e5704f06fc@app.fastmail.com> Content-Language: en-GB In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit From: imsop.php@rwec.co.uk ("Rowan Tommins [IMSoP]") On 05/03/2025 21:10, Edmond Dantes wrote: > Essentially, this is Kotlin, but it should also resemble Python. > However, unlike Kotlin, there are no special language constructs > here—code blocks naturally serve that role. Of course, syntactic sugar > can be added later for better readability. To pick up on this point: PHP doesn't have any generalised notion of "code blocks", only Closures, and those have a "weight" which is more fundamental than syntax: creating the Closure object, copying or referencing captured variables, creating a new execution stack frame, and arranging for parameters to be passed in and a return value passed out. Perhaps more importantly, there's a reason most languages don't represent flow control purely in terms of functions and objects: it's generally far simpler to define "this is the semantics of a while loop" and implement it in the compiler or VM, than "these building blocks are sufficient that any kind of loop can be built in userland without explicit compiler support". Defining new syntax would encourage us to define a minimum top-level behaviour, such as "inside an async{} block, these things are possible, and these things are guaranteed to be true". Then we simply make that true by having the compiler inject whatever actions it needs before, during, and after that block. Any additional keywords, functions, or objects, are then ways for the user to vary or make use of that flow, rather than ways to define the flow itself. This is roughly what happened with Closures themselves in PHP: first, decide that "$foo = function(){};" will be valid syntax, and define Closure as the type of $foo; then over time, add additional behaviour to the Closure class, the ability to add __invoke() hooks on other classes, etc Regards, -- Rowan Tommins [IMSoP]