Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:126836 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 5B68D1A00BC for ; Wed, 19 Mar 2025 08:44:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1742373694; bh=B3BYKYe7Lte3gJH4EDANRXZssIC8enu8SXbYKIagBm4=; h=Date:From:To:Subject:In-Reply-To:References:From; b=kFUDbfkGY6zexs/uzQQU/J03Z4ncy+CyjULXwT/qBxDFCq1UPFoXyToFMB4TyVLwg dN9SJjlkYfZrqFapBamoFgCv8jr9V/3HmWDXmdb7Wd4AWNGUG7wSQKKSDQ60X0g7Ig kLLWnTsOaJhFVT3eOZyPZ2BcTKyVfCC88lwWGDC7xp6AkZ/kWkDZoVTopBUxGWECD2 mLlEXwgZ1BX91iZoJ3cIiX+6ywZFXe/rD1q24kpN6YeKA0LHpHK3motGiPLqAu12i7 dEWmprGQQj+0RgbEICdCx5fObMZ5QryO9l5ZLWhOD/Dpw3tke2pFikRXZCQVzOXhCs TVN8BPlM/co6g== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id E6A2D180072 for ; Wed, 19 Mar 2025 08:41:33 +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, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from fhigh-b5-smtp.messagingengine.com (fhigh-b5-smtp.messagingengine.com [202.12.124.156]) (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, 19 Mar 2025 08:41:33 +0000 (UTC) Received: from phl-compute-05.internal (phl-compute-05.phl.internal [10.202.2.45]) by mailfhigh.stl.internal (Postfix) with ESMTP id 4B1B425401ED for ; Wed, 19 Mar 2025 04:44:04 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-05.internal (MEProxy); Wed, 19 Mar 2025 04:44:04 -0400 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=1742373844; x=1742460244; bh=B3BYKYe7Lte3gJH4EDANRXZssIC8enu8SXbYKIagBm4=; b= IFdN+Wze0gIwfZHJqzjDj2l/E/EJ1t9NC9YfEg6lPFUSLTVzJ/XmrzzZgWUWo+Qe WjAI1gHT7H+x7n6DfcdyxufbtYBffr0s49yC/mtREh4wYvavOOwALOYbGwKM3uhT l5KQSCf25aQE0u/Ro/3Ompg/CF4mPNDDMfekCX8aAhJEH2WNrr4LSDQLzFj8Qe36 zApoNmXwz+CqhiCKP9npx0MDARmPbFbyc8bTDT0zjKMDEk0YVE/1l7bnI66OSKZk QXZ06X5tdOzyht8XG6ix6gi6jdLXQpjzDjDQQyrztz2vjL1w+98mQ/p1iR+LJ84w cCDwsCfmOnOKOtZrKapMEw== 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=1742373844; x=1742460244; bh=B 3BYKYe7Lte3gJH4EDANRXZssIC8enu8SXbYKIagBm4=; b=KGBDaGdxM+FwVj0QE Xs4KGbZq04Eb3QwcriAvGUqJbv0LnTcOjK08pmjPRd2b20cJ0+1HjBY50PFoDPf0 qzBSfPmqZLsiUMdyvncKrqHzkUFS4CEOvVEtI7xWFo6EAqY7K19hxlTEmomdMW6N PWuf4n86zGHP2VHlnEzOI9f36CAJ99dayir1Gd+QSaiTAyaCkA3/GE85rxGLXljF GpTiex+P5sZ/Be+t52VvA9CRVoYfdMdwSllExUjr3Wy3tW8Q9wbEEeBipKPVtDiD J7Q4gTjoKoLsPjD+1KYat99y/DnceNQL2GXeeBIIP7W7ORmzRv4kut4lhmlMlRwR nTfdw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddugeegkeekucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggv pdfurfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpeffhf fvufgfjghfkfggtgfgsehtqhhmtddtreejnecuhfhrohhmpedftfhofigrnhcuvfhomhhm ihhnshculgfkoffuohfrngdfuceoihhmshhophdrphhhphesrhifvggtrdgtohdruhhkqe enucggtffrrghtthgvrhhnpefhhfefjefhueeuleffkedtvddtfeffgedtfedtgfejgfdu heejheffhfelkeffgfenucffohhmrghinhepthhhvghphhhprdhfohhunhgurghtihhonh dpphhhphdrnhgvthenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhl fhhrohhmpehimhhsohhprdhphhhpsehrfigvtgdrtghordhukhdpnhgspghrtghpthhtoh epuddpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepihhnthgvrhhnrghlsheslhhi shhtshdrphhhphdrnhgvth X-ME-Proxy: Feedback-ID: id5114917:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Wed, 19 Mar 2025 04:44:03 -0400 (EDT) Date: Wed, 19 Mar 2025 08:44:00 +0000 To: internals@lists.php.net Subject: Re: [PHP-DEV] PHP True Async RFC - Stage 2 User-Agent: K-9 Mail for Android In-Reply-To: References: <72bd5401-53a9-409f-ad45-687333401961@rwec.co.uk> Message-ID: 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 19 March 2025 07:07:36 GMT, Edmond Dantes wro= te: >Continuing the discussion from [[PHP-DEV] PHP True Async RFC - Stage 2]( >https://discourse=2Ethephp=2Efoundation/t/php-dev-php-true-async-rfc-stag= e-2/1573/24 >): > >[quote=3D"Rowan_Tommins_IMSoP, post:24, topic:1573"] Just a quick reminder that although various mirrors exist, this is primari= ly a mailing list, and email clients won't parse whatever unholy mix of mar= kdown and BBCode that is=2E A bit of punctuation for things like emphasis etc is fine, but how it look= s on https://news-web=2Ephp=2Enet/php=2Einternals is going to be how it loo= ks for a lot of contributors=2E >I meant that the `defer` operator is needed in the language not only in t= he >context of coroutines but in functions in general=2E In essence, `defer` = is a >shortened version of `try-finally`, which generates more readable code=2E > >Since that's the case, I shouldn't describe this operator in this RFC=2E >However, `onExit()` and `defer` are essentially almost the same=2E Ah, I get it now, thanks=2E >spawn [with ] [()]; > >spawn (getClosure()); > >spawn sleep(5); You're cheating again - you've put an extra pair of brackets around one ex= pression and not the other, and assumed they'll work differently, but that'= s not the grammar you proposed=2E It's possible we could resolve the ambiguity that way - if it's in bracket= s, it's evaluated as an expression - but then all the other examples need t= o be changed to match, including this one: >spawn function() use(): string { return "string"; }; Instead you'd have to write this:=20 spawn (function() use(): string { return "string"; }); In the end, it still comes back to "there are two grammar rules here, how = do we name them?" Only this time its "spawn" vs "spawn()" rather than "spaw= n" vs "spawn call", or all the other examples I've used=2E >[quote=3D"Rowan_Tommins_IMSoP, post:24, topic:1573"] >The only caveat is that calls using the nullsafe ?-> operator are forbidd= en >- for reasons directly related to the feature, not because Nikita thought >they were ugly=2E >[/quote] > >Yes, that's exactly what we'd like to avoid=2E Sorry, what is exactly what we'd like to avoid? > >[quote=3D"Rowan_Tommins_IMSoP, post:24, topic:1573"] >But most likely you'd still want a separate syntax for a direct function >call, however you want to spell it: >[/quote] > >**Exactly!** It turns out that the expression `spawn something();` >can be interpreted as if `something` is a PHP constant rather than a >function=2E It's more fundamental than that: function_call and expr are overlapping gr= ammars, so having a rule that spawn can be followed by either of them, with= different meanings, leads to ambiguities=2E You can carefully tune the gra= mmar to avoid those, but then the user has to learn those rules; or you can= just use two keywords, which I don't remember you actually responding to a= s a suggestion=2E Rowan Tommins [IMSoP]