Newsgroups: php.internals
Path: news.php.net
Xref: news.php.net php.internals:126575
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 D09241A00BC
	for <internals@lists.php.net>; Wed,  5 Mar 2025 10:30:56 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail;
	t=1741170500; bh=edNciNiIkLIChbRXwtKBdAjb2GgSVg1eKC5/ycSJFQg=;
	h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id:List-Post:
	 From;
	b=Ywe7aMhfO/1Gh2ldh2XT5YSdfCAdbxaALxzwD/sPOOl40ikqsfyRVXyc2yYjXopzb
	 hd5BQvXz1mwGcDOAEq4BdOl5XpnEP1q4juaZUlkujXoA0RiMWoBv2hRnsqTJDj+Tya
	 8SabUJbZKY2nzTzndKDUqkDARoILIT81+t3RJc4PJYECs6I26tKo2U7sL5K3OTuuE/
	 WA+1vbR1iHGeGyBQVCL5KeURlUrNwd3Xz75Ph2adg0mgkT+forwY4JLb1LyK8peLOa
	 WcVeRVSTnQGU7NK+cPz8WZXG9A+PiZX6gHyzd+/ZdNVSz9jKV35Di1r0bX4ygIrq3/
	 rTS9Swnpgsaug==
Received: from php-smtp4.php.net (localhost [127.0.0.1])
	by php-smtp4.php.net (Postfix) with ESMTP id E60AD180053
	for <internals@lists.php.net>; Wed,  5 Mar 2025 10:28:19 +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.2 required=5.0 tests=BAYES_50,DKIM_SIGNED,
	DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,FREEMAIL_FROM,
	HTML_FONT_LOW_CONTRAST,HTML_MESSAGE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,
	SPF_PASS autolearn=no autolearn_force=no version=4.0.0
X-Spam-Virus: No
X-Envelope-From: <edmond.ht@gmail.com>
Received: from mail-ej1-f44.google.com (mail-ej1-f44.google.com [209.85.218.44])
	(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>; Wed,  5 Mar 2025 10:28:19 +0000 (UTC)
Received: by mail-ej1-f44.google.com with SMTP id a640c23a62f3a-abfe7b5fbe8so439171566b.0
        for <internals@lists.php.net>; Wed, 05 Mar 2025 02:30:55 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20230601; t=1741170654; x=1741775454; darn=lists.php.net;
        h=mime-version:user-agent:list-post:list-id:references:in-reply-to
         :date:subject:cc:to:from:message-id:from:to:cc:subject:date
         :message-id:reply-to;
        bh=m9D4qgMjCTBbaDnNz3jGy9J1V+bPlIbY+gxhpG26BSw=;
        b=RsrYxlpT1hPzFtzjcHoDAaNh1n1llLCzTz3mVVMVLbD5OUKpCnHxmtBgTSwWvw4Z0R
         bzYxlzdQfkGVfFOKhP/xwotlPPadE4UkwgnBllgG2vTujRsqoXIWyUjurY9J0zMRrLAD
         23PA5A5Wn9Ru2z+PvhwAsHQvN0yfxfjdHAP2+ELn9yG7xAUDYG4kilJehzpFtog5YKAI
         OfIlrwtEp5XwSSihxiLqE701iHDKpkMnjan8/I+eIcfRjDCoZKvDOkCi74ad2I0tq8Lu
         fQ9r7tzBEqilcCP2wKuBEVC0IHOafujQ7+UrbAibCrzOBv0D0rg0nR+xfhH8hRmfKgui
         l1zQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20230601; t=1741170654; x=1741775454;
        h=mime-version:user-agent:list-post:list-id:references:in-reply-to
         :date:subject:cc:to:from:message-id:x-gm-message-state:from:to:cc
         :subject:date:message-id:reply-to;
        bh=m9D4qgMjCTBbaDnNz3jGy9J1V+bPlIbY+gxhpG26BSw=;
        b=RyccYtggzyWExh0W51wmMordnT04Vai2k/uj0x/tlj5Dx2uDXJJYGfqHiCM2LhJa89
         F6PVAURd+Pt+keHt1qUwMfasnQmVYQNmb3exy9NQ7DerGYasV0uD58QOtnYRIwQeSoWZ
         16+3OgSSqHh1fWYyZ4mY3Ir1ScCE/F0ZOCwT3U8RTr3QNKdb8/wtnzjn7TxZQ1WgcQWq
         NBUwHayAwlw9pD8ZOHcx2qQzlQTq4jqu2qxUuJgKyT5oXU4Qp0FUwGO/7pAlYf+XfhwK
         /a5LKOqvQwufLULK7YYmu93jQiqNpYWcspDBoaQpzw/RuDlZNnGp/AeCYzc+62xZ1CDl
         SmxA==
X-Gm-Message-State: AOJu0YzhCSNctej5Z21qwdETYWUVvwpPKQPLpG3+0arE+Yog+XWo0UwC
	5sEVoJ1dMoPpAdORLiE8g7GGsxgseQQwiRgJWM2MjtMG5PpHi5E/TIItAT7o
X-Gm-Gg: ASbGncsSPxdjwSYiXUFHEdll7eAkqpNxaO3YEG1w2z/RUqifviupRpz3gQT3DPtoK8K
	v6oeR9oi72dzil+ySD7aYxSeCuvKtEAh2FOd8aaNaJZ/un/SB7ZcejFnl8ilKrTm8HQ4NiQMW8l
	eKDgu7lpWNFp5p68HJftQhEShXmV7emEm2xXz7nS6Yv7l8ye+Vyc4cffnUg5InLD5uAMhi8ZhYv
	QSuZzVUGic/c0FJSB5wYz6gOOyRbVpAR9vqFZApHenqMA4S5sj1QKLiSY34pB2QKtrzpVaEjgOl
	uptfgXwQRSkTf22ngGbUyTUFduvVCFp+IyedyA5E8qMwIxRvRidvHCTw7L48sxdF
X-Google-Smtp-Source: AGHT+IHPNrCelNxA10WjshkM5ECiJQGHrjAgSJCwgJOs0qP8A6n77vK/zlwtUYYBy7k5dmvvYaWCvg==
X-Received: by 2002:a05:6402:13cd:b0:5dc:74fd:abf1 with SMTP id 4fb4d7f45d1cf-5e59f3ee29amr6142312a12.15.1741170654007;
        Wed, 05 Mar 2025 02:30:54 -0800 (PST)
Received: from noip.localdomain ([77.239.166.57])
        by smtp.gmail.com with ESMTPSA id a640c23a62f3a-abf6f85ea15sm570594866b.111.2025.03.05.02.30.53
        (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
        Wed, 05 Mar 2025 02:30:53 -0800 (PST)
Content-Type: multipart/alternative;
 boundary="----sinikael-?=_1-17411706523220.6580496559372415"
Message-ID: <1741169717342.25808380.3585735442@gmail.com>
To: Eugene Sidelnyk <zsidelnik@gmail.com>
Cc: php internals <internals@lists.php.net>
Subject: Re: [PHP-DEV] PHP True Async RFC
Date: Wed, 05 Mar 2025 10:30:52 +0000
In-Reply-To:
 <CAM0CcxhgOCsy46gp1qd4Zrdw8v0TfTkTTMin5EiHW18EDZRzwg@mail.gmail.com>
References:
 <CAM0CcxhgOCsy46gp1qd4Zrdw8v0TfTkTTMin5EiHW18EDZRzwg@mail.gmail.com>
List-Id: internals.lists.php.net
List-Post: <mailto:internals@lists.php.net>
X-Mailer: Vivaldi Mail
User-Agent: Vivaldi Mail/7.1.3570.50
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
From: edmond.ht@gmail.com (Edmond Dantes)

------sinikael-?=_1-17411706523220.6580496559372415
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit

Hello, Eugene!





What I think it could be.


async function baz(): int {
   $foo = foo();
   $bar = bar();


   return $foo + $bar;
}


// value is returned just like from any other ordinary function
$val = baz(); 





If we have code like $x + $y, and in one block it follows rule 1 while in 
another block it follows rule 2, this increases the complexity of the 
language. The worst part is that the same operators exhibit DIFFERENT 
behavior in different contexts. This violates semantic integrity. (A 
similar issue occurred in C++ with operator overloading, where a 
theoretically elegant solution turned out to be terrible in practice).

If you want to achieve a clean syntax for concurrency in PHP, I would 
suggest considering pipes in the long run.

For example:

|> $users = getUsers() ||| $orders = getOrders()
|> mergeByColumn($users, $orders, 'orders')

-- 

Ed.
------sinikael-?=_1-17411706523220.6580496559372415
Content-Type: text/html; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit

<html><head></head><body><span class="viv-signature"></span>Hello, 
Eugene!<br><blockquote style="margin: 0 0 0.80ex; border-left: #0000FF 2px 
solid; padding-left: 1ex"><div dir="auto"><div 
dir="auto"></div></div></blockquote><br><blockquote style="margin: 0 0 
0.80ex; border-left: #0000FF 2px solid; padding-left: 1ex"><div 
dir="auto"><div dir="auto"><br></div><div dir="auto">What I think it could 
be.</div><div dir="auto"><br></div><div dir="auto">async function baz(): 
int {</div><div dir="auto">&nbsp; $foo = foo();</div><div dir="auto">&nbsp; 
$bar = bar();</div><div dir="auto"><br></div><div dir="auto">&nbsp; return 
$foo + $bar;</div><div dir="auto">}</div><div dir="auto"><br></div><div 
dir="auto">// value is returned just like from any other ordinary 
function</div><div dir="auto">$val = baz();&nbsp;</div><div 
dir="auto"><br></div></div>
</blockquote><span class="viv-signature-below"><div><span 
class="viv-signature-below"><br></span></div><div><p data-end="420" 
data-start="0">If we have code like <code data-end="30" data-start="21">$x 
+ $y</code>, and in one block it follows rule 1 while in another block it 
follows rule 2, this increases the complexity of the language. The worst 
part is that the same operators exhibit DIFFERENT behavior in different 
contexts. This violates semantic integrity. (A similar issue occurred in 
C++ with operator overloading, where a theoretically elegant solution 
turned out to be terrible in practice).</p><p data-end="534" 
data-start="422">If you want to achieve a clean syntax for concurrency in 
PHP, I would suggest considering pipes in the long run.</p><p 
data-end="548" data-start="536">For example:</p><p data-end="548" 
data-start="536">|&gt; $users = getUsers() |||&nbsp;$orders = 
getOrders()<br>|&gt; mergeByColumn($users, $orders, 'orders')</p><p 
data-end="548" data-start="536"><span style="background-color: 
var(--colorBgIntense); color: 
var(--colorFgIntense);">--&nbsp;</span></p></div>Ed.</span></body></html>
------sinikael-?=_1-17411706523220.6580496559372415--