Newsgroups: php.internals
Path: news.php.net
Xref: news.php.net php.internals:126683
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 C47811A00BC
	for <internals@lists.php.net>; Mon, 10 Mar 2025 03:55:44 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail;
	t=1741578790; bh=CyacL/g55aY0XBR+g7xQu7Z7wa6BDS7UQZqIGhd60+o=;
	h=Date:From:To:In-Reply-To:References:Subject:From;
	b=hZ58lL2cF28I8PXaUB+Fi0ds7xinVAdIL/1SJL0TgN2IjxY1YrhrftahzeRNgGYNs
	 aoXWd60m3TXNsRxhqKcjynlN5WQbfOK0g+Uda8Vy0xMZGPsNApxJpYBpWSs/aoI2Jb
	 O0Sd3quRzcQj6vYc8nyKBWtcNroTXzd/WgyGNyehSZSv4w+xHG/OPFr9BYFa++baox
	 tbygWuBy/nUWwRjBJRRT2rFdkCDCXvtpFuDXFClfbZ4t7VQOBFyq3uQtVqrpLjz0ev
	 yi4GksuJqJuGVBE94qXTqMvGy3xYZ/PVDjyXXQ0/tDwYp2r7Ugbvk+uSjo1M3d6cr7
	 TH0uMjLnakwow==
Received: from php-smtp4.php.net (localhost [127.0.0.1])
	by php-smtp4.php.net (Postfix) with ESMTP id 84C14180082
	for <internals@lists.php.net>; Mon, 10 Mar 2025 03:53:08 +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_NONE autolearn=no autolearn_force=no version=4.0.0
X-Spam-Virus: No
X-Envelope-From: <larry@garfieldtech.com>
Received: from fout-b8-smtp.messagingengine.com (fout-b8-smtp.messagingengine.com [202.12.124.151])
	(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 <internals@lists.php.net>; Mon, 10 Mar 2025 03:53:08 +0000 (UTC)
Received: from phl-compute-04.internal (phl-compute-04.phl.internal [10.202.2.44])
	by mailfout.stl.internal (Postfix) with ESMTP id 0A7ED1140159
	for <internals@lists.php.net>; Sun,  9 Mar 2025 23:55:42 -0400 (EDT)
Received: from phl-imap-06 ([10.202.2.83])
  by phl-compute-04.internal (MEProxy); Sun, 09 Mar 2025 23:55:42 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
	garfieldtech.com; 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=1741578941; x=1741665341; bh=850/Rn5kMdPbnKkQgFN4r
	JXekrUZQFo2UuS67FxcsL4=; b=U256Ql4k9F1tXrEqSGQNyi2cIN2Nixlf6oXE7
	V1u9ARpPsLuFg63SpkMIqccADu7yJK9WuNj6IwN0OjBcYap07G2fgYxQzg0RHECd
	YtNFS1N4mmE2VuDRmyxwC6bH1wW9frQhMJ84GB1w24Gb1kyJX3xxQcGFfODYgN5o
	b8k78oi16E5P9zvhk7Z7uLHJLV4bP3z6IcYDJ18ULiAZOiaxIfwvdm3//8x/IvpT
	iADb+VSPuUtZqG7NcEmxW/xDKNFIosBQncPWgpZUKTMKM0wuBTQJanuHmQuYG6VE
	yJpj8aSdne57N5COllmEw9Ir/oqF2sCR9xbBL+q3q6UoKod5w==
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=1741578941; x=1741665341; bh=8
	50/Rn5kMdPbnKkQgFN4rJXekrUZQFo2UuS67FxcsL4=; b=QV2n6vzI+M5doraDD
	218KryxAnNRjDDuiczRmCzqhYR/MwPGiClkm7JPPFYjxuRdkOD6+7OyWSm4QqVTw
	PL5qKK4MdYeHzUnLeyluJRmrSjT8232g9aj9tQwR36edX0OAakZbO2Qr/PCxMfDy
	X4XnPQZU/DiVEH3BQ7mWyquFehtRlA8yN2Ks+XwQc2PxTbhaOR8amk8+p6wWXH2G
	JXOMP8KgpzxifZtHC60sGBgcoVPhLvpl9+hjZQsZ5eqVN/RPdd/Pa7D/cc4AnTc/
	K1ZnnpcvRXbSrCNcFGgiWI4MzQ+x3ddeHS2nFzTxRXJ3HaO14YKI5ZFjfSLdkFPi
	YoGsQ==
X-ME-Sender: <xms:vWLOZ5F1dBkmFkFtrbZVVGq_zmCT4r58uwW5NVSDvL8N9Bio8wJkkw>
    <xme:vWLOZ-Vw2N-uekJw8dImRMMoCqHEY0K__wLJEqlntYwbXtbuTm2BkU1d-ineY3WqV
    AONn0QDc48Odw>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdduudekfeduucetufdoteggodetrf
    dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggv
    pdfurfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpih
    gvnhhtshculddquddttddmnecujfgurhepofggfffhvffkjghfufgtgfesthejredtredt
    tdenucfhrhhomhepfdfnrghrrhihucfirghrfhhivghlugdfuceolhgrrhhrhiesghgrrh
    hfihgvlhguthgvtghhrdgtohhmqeenucggtffrrghtthgvrhhnpedugedvlefgueegheef
    jeetffduveeltefhfeegjeffffelgedttdevkeegkedugfenucevlhhushhtvghrufhiii
    gvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehlrghrrhihsehgrghrfhhivghlught
    vggthhdrtghomhdpnhgspghrtghpthhtohepuddpmhhouggvpehsmhhtphhouhhtpdhrtg
    hpthhtohepihhnthgvrhhnrghlsheslhhishhtshdrphhhphdrnhgvth
X-ME-Proxy: <xmx:vWLOZ7InEmWzYUamQ7BijAfpFLJCyt3B0BiQY7_gHlFphWdbXwvupw>
    <xmx:vWLOZ_E-YJFPZbHSPjVWtWdX-LP5amwJ_b1fP2YF1xueGw0UugeBNg>
    <xmx:vWLOZ_UW9571xLc4dmthyZIXurRjZfWrFt0SfnF8FHZEul4hbnRuPQ>
    <xmx:vWLOZ6OAl86pn9hPWUWzgMqJ_2tOzNj7QAcqs-DJE7mWZyCmruh-LA>
    <xmx:vWLOZ2D74UQtMMhJlOdOUx2EO47N4VMd3rt97tffaOoxzxXvHk9ZGsn8>
Feedback-ID: i8414410d:Fastmail
Received: by mailuser.phl.internal (Postfix, from userid 501)
	id 9507329C006F; Sun,  9 Mar 2025 23:55:41 -0400 (EDT)
X-Mailer: MessagingEngine.com Webmail Interface
Precedence: bulk
list-help: <mailto:internals+help@lists.php.net
list-unsubscribe: <mailto:internals+unsubscribe@lists.php.net>
list-post: <mailto:internals@lists.php.net>
List-Id: internals.lists.php.net
x-ms-reactions: disallow
MIME-Version: 1.0
Date: Sun, 09 Mar 2025 22:55:21 -0500
To: "php internals" <internals@lists.php.net>
Message-ID: <def2620e-9a99-4a6f-b414-3c9f74232f5c@app.fastmail.com>
In-Reply-To: <e65708a0-5130-4726-b405-e3185562d770@rwec.co.uk>
References: 
 <CAMW7n8AJckEDzhGv9BdjNhq8zAdCqb4HsVr56vGi+izw50X6Dg@mail.gmail.com>
 <CAMW7n8CAbKRY9RZsJNSnehKVv8NNGtygocxc+zHBS4h9iRyUGA@mail.gmail.com>
 <1b6a5b3b-be9b-4e46-9cc6-b8b7f57b8494@app.fastmail.com>
 <CAMW7n8AumA6bYZ+7+c3rAEeYj0=35wgmohRbrJbH=fc=Ra0FJg@mail.gmail.com>
 <e65708a0-5130-4726-b405-e3185562d770@rwec.co.uk>
Subject: Re: [PHP-DEV] Re: PHP True Async RFC
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
From: larry@garfieldtech.com ("Larry Garfield")

On Sun, Mar 9, 2025, at 8:17 AM, Rowan Tommins [IMSoP] wrote:

> That leaves the question of whether it would ever make sense to nest 
> those blocks (indirectly, e.g. something() itself contains an async{} 
> block, or calls something else which does).
>
> I guess in our analogy, nested blocks could be like running Containers 
> within the currently running OS: they don't actually start a new 
> Scheduler, but they mark a namespace of related coroutines, that can be 
> treated specially in some way.
>
> Alternatively, it could simply be an error, like trying to run the 
> kernel as a userland program.

Support for nested blocks is absolutely mandatory, whatever else we do.  If you cannot nest one async block (scheduler instance, coroutine, whatever it is) inside another, then basically no code can do anything async except the top level framework.

This function needs to be possible, and work anywhere, regardless of whether there's an "open" async session 5 stack calls up.

function par_map(iterable $it, callable $c) {
  $result = [];
  async {
    foreach ($it as $val) {
      $result[] = $c($val);
    }
  }
return $result;
}

However it gets spelled, the above code needs to be supported.

--Larry Garfield