Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:126847 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 5402B1A00BC for ; Wed, 19 Mar 2025 17:10:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1742404074; bh=Hcxbwpq+dngNoDoyx/GbbJQDB/xUS+KI0kUYXLb5G0k=; h=Date:From:To:Subject:In-Reply-To:References:From; b=Ri+QOeXiRe1UVCebbZX4Ug6Qv3BjmSJiokThNmZBOp2uAASf7Lm8uFlyfD5JQo3bw YgR7mV+8m2XAXQnvS1++JrS+5DYjDk/bFOC1xfCv48ub84VWPCO8c0oo/7YikCTW1g WOSwbEPlIrb51vxzpieXbPWqcr2TikqMfFG9aWlXC2MXES9DOo/N684/BiBfaCcbek tVYMYvuDNcmbVbpl/D61OBdkagGw9YoOkl5HJr6NgwbiVHNPSI33UU593Mvo6lonBy i28CNffIgNEBr9yfQ+ruonXlEpqCaPLqujDuEyIiwo2rROZXUQrMN4TZ8Ekm5rlDW4 sUEOw2tDfQX3Q== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id D57B3180071 for ; Wed, 19 Mar 2025 17:07:53 +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=-3.2 required=5.0 tests=BAYES_05,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from fhigh-a5-smtp.messagingengine.com (fhigh-a5-smtp.messagingengine.com [103.168.172.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 17:07:53 +0000 (UTC) Received: from phl-compute-09.internal (phl-compute-09.phl.internal [10.202.2.49]) by mailfhigh.phl.internal (Postfix) with ESMTP id 5EAC51140223 for ; Wed, 19 Mar 2025 13:10:24 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-09.internal (MEProxy); Wed, 19 Mar 2025 13:10:24 -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=1742404224; x=1742490624; bh=wVc7H4RD5Dmas70aehKg8jBFOOGDbQaOfmJUTrkUqpU=; b= lOgp9dK76a8djyyle6Y70FqA1jkdwc2MsAIbCCy9Olwuw693SCheXjSrRf4MXVBA 4v1sWYyRGzhmpLUQIyUS6uRoXqJbmRqx1/9qbzmqn3RvVbxPJpPN9gyFjXp0Y4ej LROMqDZ5m9wgHvCRCY3K06ASpURreKqQYpmPc+wMzl4nJB/izm+vzrL+ReMJetc3 43hoiM8KJp1qDFKb0Cpoj5csgMmS3Ze6bSxd3U7fRXpRv3P4+NPoOvveXFGfq+mf R1ufXxgg2oGMV3Yoz7t2gciPFiLcOv4tnQaknywp7CFPd+bgP2eabx/dWzSC/aF0 1jAcO5eock/yuK7BCwkS1g== 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=1742404224; x=1742490624; bh=w Vc7H4RD5Dmas70aehKg8jBFOOGDbQaOfmJUTrkUqpU=; b=5BiI3MV63dAjWw50S byfQ5YkL0Fukm8RDKD3D6xvnVLZzQQD4w5/QOZ+iQ94d+Qqx0LQmhygX1g639Mfn xQ7zya5+O4ookAsc1buIuOUZ5n72B4shQDxeu8OuXQIARotJzD+oX5HV18aT/qeL E/i3B39qO5DOB7wEA/nVyzW7hVsRVfFcvHYRRdh+2NHrvFhtIHkNdihKtufCCKMT QLujI9q/DGo4pYU2YermcqDKcomclUfLquKBLbaenoT5CRsCs8KoIaYyYbtf0lTM kbf4ugHVIIkrEuKBq17UsnvYoCjCiC+BqAacz9UW+iNnAGEBC0iSbkVLQL4/R55C l1TLA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddugeehledtucetufdoteggodetrf 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 ; Wed, 19 Mar 2025 13:10:23 -0400 (EDT) Date: Wed, 19 Mar 2025 17:10:21 +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> <6987D912-CE46-4145-A8CE-732CA590A522@rwec.co.uk> Message-ID: <2F013672-9937-4AB1-BC46-86F3D342BE6B@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 19 March 2025 15:51:38 GMT, Edmond Dantes wro= te: >> >> "Cheating" in the sense that you wrote out a "general syntax", >> >I got it=2E > >> That's not the problem; the problem is that the following are all >equivalent expressions: >> (((foo()))) > >In principle, this is not a problem because the expression in parentheses >preceded by `spawn` is unambiguously a call expression=2E >That is, from an analysis perspective, everything is fine here because th= e >expression `spawn ()` is a syntax error=2E This has nothing to do with my examples=2E If you start with a valid expression, you can add any number of parenthese= s around it, and get another valid expression, with the same meaning=2E A f= unction call is an expression, and a function call wrapped in parentheses i= s another way of writing the same expression=2E But even though we're talking in circles about why, your latest examples d= o avoid the particular problem I was trying to describe=2E >From the user's perspective, what is the difference between these two >expressions? > >```php >spawn function(): string { =2E=2E=2E }; >spawn (function(): string { =2E=2E=2E }); >``` Yes, that would probably be a bad choice as well=2E Which is why I've repe= atedly suggested a different keyword, and AFAIK you still haven't actually = voiced an opinion on that=2E >If we define the rule `spawn function_call`, then `spawn` acts as a prefi= x >in this expression=2E However, everything that is already defined for >`function_call` in PHP must remain valid=2E Yep, I'm totally fine with that=2E But you kept referring to that token as= "expression", which confused me, because that's a different thing in the g= rammar=2E >The second form of the `spawn` expression is: >```php >spawn inline_function >``` This part totally makes sense from a syntax point of view, I just think it= has bad usability - the user has to type a bunch more boilerplate, which l= ooks like something it's not=2E >> If it's going to be a special case for an "inline coroutine", just use= a >keyword other than "function", so it doesn't look like an expression when >it's not, like "spawn block { =2E=2E=2E }"; or no keyword at all, just "s= pawn { >=2E=2E=2E }" >> > >Well, yes, but here we again face the issue with `returnType` syntax, whi= ch >ends up hanging in the air=2E=2E=2E I think I asked this before: why would anyone want to specify a return typ= e there?=20 I assumed the actual user scenario we're trying to solve is "I have a bunc= h of statements I want to run in a new Coroutine, but they're not worth put= ting in a function"=2E So to the user, having all the features of a functio= n isn't relevant=2E We don't allow specifying the return type of a match st= atement, for example=2E Do you have a different scenario in mind? Rowan Tommins [IMSoP]