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.