Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:126674 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 B8B251A00BC for ; Sun, 9 Mar 2025 12:17:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1741522465; bh=jy2oIxV4Gx08dxq9LsoiyaXzGscDoLw7BW9CBx1l9bQ=; h=Date:Subject:To:References:From:In-Reply-To:From; b=ECvRXM9AQCcWSGspKn3cPbra58xCDu7+7V93xnVo6+cDMjbAMmKT8c7f0nkuDVlpf 4r8c6WlH1mGbqw6jEf7j8z9qC8brB3TnLa9cG3CstccqfbjPShOGIPXqvLXWPHd8AD j8RADZT/c3VLYyCeAvmjzVB5JzITWTJkJe5d4ExjdR18Cv0QjDdz79r5TnxM/0BVMt dpnhNW46QFRVBlYoZnXypp3U5Zq71lQ7xaO1H8toml2VN4Hm+fOzOy78HAooVctf75 P9g5eoSDNrHrYQZ4Mqh8k9WYlWeB5Hs1o0yDemUeJM23HTjyfCFN7baqZBBpnb/63P /c70FJne5mKpw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 6F8B3180069 for ; Sun, 9 Mar 2025 12:14:24 +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=-1.4 required=5.0 tests=BAYES_05,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,HTML_MESSAGE, 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-b6-smtp.messagingengine.com (fout-b6-smtp.messagingengine.com [202.12.124.149]) (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 ; Sun, 9 Mar 2025 12:14:24 +0000 (UTC) Received: from phl-compute-11.internal (phl-compute-11.phl.internal [10.202.2.51]) by mailfout.stl.internal (Postfix) with ESMTP id 499B311400E9 for ; Sun, 9 Mar 2025 08:16:58 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-11.internal (MEProxy); Sun, 09 Mar 2025 08:16:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rwec.co.uk; h=cc :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=1741522618; x=1741609018; bh=BI8ywxhOZs 0U9TfTYCY/zEDI5J7nqP3PY3OL3m4QzHk=; b=BREixwHhJ9AQvCaLrN4DCBE5Z2 f9QtPD156S+oJOypOSldziJ0o68LO+15zHmCLwegJNkTaH0JdJiKjkdImFpR636V fQ2Mte2yTYRCvCPq4A1+3CkMfYjMghM45EJCSvDrx2JsE7ggxyH17ts4MBuWBbH0 3FFA9QCHnbQN675gQsc8ApKy91gulagPEP2Eq0kASCwRAr+bZ+jc+lUSiBsFdJ8Q 8rCq/7Ftybq8wfOZxVfSwhpAZmM6NHvDJcRRElwt4VfCmzkmWfvd964PdYa6tPn8 oWl/NtvQwxLrvo9nqp6ojr6gJVFRxV5lSCzsYJ/aZ8yiiz5OJKR0HWHzJDew== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc: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= 1741522618; x=1741609018; bh=BI8ywxhOZs0U9TfTYCY/zEDI5J7nqP3PY3O L3m4QzHk=; b=jx0PwG3yEloENvf4mpybbC0Ty2x3e7jTuL5fx2XADLoys6TDWeS liXVwmQehc6xiTenvkJFo4Jou6D8yJ9gdMODH8rq8PITGGy4bpGPh7Azr1cT2D/w K8EkP1M6CciT3iAfajghuq4I5QlqIsKy1WNhdZG6PrDlHYca7fCYLvt88X/P37qQ Y0NnWa+yJpr81MjeHLFT3+S8lj+H4TE0mZx45QMaS76T1Sfn6YKk6XwJsj/X9eoo YBIAm+V5tHYeMpSF/KadZiMX0uwiHCZw6A7y2QLsoh7iUmo4oP2sQm9sMqlJy+7X bLOKnG3gss4j07mdokMelP75/Rj2gC6FbHQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdduudeigedvucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggv pdfurfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpegtkf ffgggfuffvfhfhjgesrgdtreertddvjeenucfhrhhomhepfdftohifrghnucfvohhmmhhi nhhsucglkffoufhorfgnfdcuoehimhhsohhprdhphhhpsehrfigvtgdrtghordhukheqne cuggftrfgrthhtvghrnhepveelhefgvddtffeugeetvefhgeejieegleefleehffdvudfg gfehtdehteduvdelnecuffhomhgrihhnpegvgihtvghrnhgrlhhsrdhiohenucevlhhush htvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehimhhsohhprdhphhhp sehrfigvtgdrtghordhukhdpnhgspghrtghpthhtohepuddpmhhouggvpehsmhhtphhouh htpdhrtghpthhtohepihhnthgvrhhnrghlsheslhhishhtshdrphhhphdrnhgvth X-ME-Proxy: Feedback-ID: id5114917:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Sun, 9 Mar 2025 08:16:57 -0400 (EDT) Content-Type: multipart/alternative; boundary="------------71PHhajYBypAm09EOmzR460i" Message-ID: <589e1df3-3584-4986-a62a-74cbedb2eb92@rwec.co.uk> Date: Sun, 9 Mar 2025 12:16:56 +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: <08c8ad0b-e8f4-46e3-99f0-b80748d40b89@app.fastmail.com> <07973EAE-2D83-47A8-8FA0-84286C77C02B@rwec.co.uk> <48d66433-3ae9-4895-8361-7c81a0a3670d@app.fastmail.com> <8599eb8b-d4a3-4cb8-899a-25b134e0d64d@gmail.com> <74c4c726-63aa-44e0-84c9-840e13a65a4f@gmail.com> <77DC5F50-531D-49E8-8BE2-504A19CB5FFD@rwec.co.uk> <676e36e4-0b84-4d8c-b3db-2998831cd79d@gmail.com> <510B8EF1-9D07-41A8-9EA0-7D99CF7BFC91@rwec.co.uk> Content-Language: en-GB In-Reply-To: From: imsop.php@rwec.co.uk ("Rowan Tommins [IMSoP]") This is a multi-part message in MIME format. --------------71PHhajYBypAm09EOmzR460i Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 08/03/2025 22:28, Daniil Gentili wrote: > Even its use is optional, its presence in the language could lead > library developers to reduce concurrency in order to allow calls from > async blocks, (i.e. don't spawn any background fiber in a method call > because it might be called from an async {} block) which is what I > meant by crippling async PHP. I think you've misunderstood what I meant by optional. I meant that putting the fiber into the managed context would be optional *at the point where the fiber was spawned*. A library wouldn't need to "avoid spawning background fibers", it would simply have the choice between "spawn a fiber that is expected to finish within the current managed scope, if any", and "spawn a fiber that I promise to manage myself, and please ignore anyone trying to manage it for me". There have been various suggestions of exactly what that could look like, e.g. in https://externals.io/message/126537#126625 and https://externals.io/message/126537#126630 > The naming of "async {}" is also very misleading, as it does the > opposite of making things async, if anything it should be called > "wait_all {}" Yes, "async{}" is a bit of a generic placeholder name; I think Larry was the first to use it in an illustration, and we've been discussing exactly what it might mean. As we pin down more precise suggestions, we can probably come up with clearer names for them. The tone of your recent e-mails suggests you believe someone is forcing this precise keyword into the language, right now, and you urgently need to stop it before it's too late. That's not where we are at all, we're trying to work out if some such facility would be useful, and what it might look like. It sounds like you think: 1) The language absolutely needs a "spawn detached" operation, i.e. a way of starting a new fiber which is queued in the global scheduler, but has no automatic relationship to its parent. 2) If the language offered both "spawn managed" and "spawn detached", the "detached" mode would be overwhelmingly more common (i.e. users and library authors would want to manage the lifecycle of their coroutines manually), so the "spawn managed" mode isn't worth implementing. Would that be a fair summary of your opinion? -- Rowan Tommins [IMSoP] --------------71PHhajYBypAm09EOmzR460i Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit
On 08/03/2025 22:28, Daniil Gentili wrote:
Even its use is optional, its presence in the language could lead library developers to reduce concurrency in order to allow calls from async blocks, (i.e. don't spawn any background fiber in a method call because it might be called from an async {} block) which is what I meant by crippling async PHP.


I think you've misunderstood what I meant by optional. I meant that putting the fiber into the managed context would be optional *at the point where the fiber was spawned*. 

A library wouldn't need to "avoid spawning background fibers", it would simply have the choice between "spawn a fiber that is expected to finish within the current managed scope, if any", and "spawn a fiber that I promise to manage myself, and please ignore anyone trying to manage it for me".

There have been various suggestions of exactly what that could look like, e.g. in https://externals.io/message/126537#126625 and https://externals.io/message/126537#126630


The naming of "async {}" is also very misleading, as it does the opposite of making things async, if anything it should be called "wait_all {}"


Yes, "async{}" is a bit of a generic placeholder name; I think Larry was the first to use it in an illustration, and we've been discussing exactly what it might mean. As we pin down more precise suggestions, we can probably come up with clearer names for them.

The tone of your recent e-mails suggests you believe someone is forcing this precise keyword into the language, right now, and you urgently need to stop it before it's too late. That's not where we are at all, we're trying to work out if some such facility would be useful, and what it might look like.


It sounds like you think:

1) The language absolutely needs a "spawn detached" operation, i.e. a way of starting a new fiber which is queued in the global scheduler, but has no automatic relationship to its parent.
2) If the language offered both "spawn managed" and "spawn detached", the "detached" mode would be overwhelmingly more common (i.e. users and library authors would want to manage the lifecycle of their coroutines manually), so the "spawn managed" mode isn't worth implementing. 

Would that be a fair summary of your opinion?

-- 
Rowan Tommins
[IMSoP]
--------------71PHhajYBypAm09EOmzR460i--