Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:107952 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 48534 invoked from network); 31 Dec 2019 01:42:46 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 31 Dec 2019 01:42:46 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 8D8C71804D2 for ; Mon, 30 Dec 2019 15:46:01 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=BAYES_20,SPF_HELO_PASS, SPF_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS31103 84.19.160.0/19 X-Spam-Virus: No X-Envelope-From: Received: from mail.toneristzuen.de (mail.toneristzuen.de [84.19.169.162]) by php-smtp4.php.net (Postfix) with ESMTP for ; Mon, 30 Dec 2019 15:46:00 -0800 (PST) Received: from maniacmansion.fritz.box (ppp-188-174-52-150.dynamic.mnet-online.de [188.174.52.150]) by mail.toneristzuen.de (Postfix) with ESMTPSA id 43E4144D3E; Tue, 31 Dec 2019 00:45:59 +0100 (CET) Message-ID: <8379d3a64de961274b1135ff35a6150e6c196449.camel@schlueters.de> To: Stanislav Malyshev , Robert Hickman , Aran Reeks Cc: PHP internals Date: Tue, 31 Dec 2019 00:45:58 +0100 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5-0ubuntu0.18.04.1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Support for Async / Await From: johannes@schlueters.de (Johannes =?ISO-8859-1?Q?Schl=FCter?=) On Mon, 2019-12-23 at 10:55 -0800, Stanislav Malyshev wrote: > Hi! > > > Does this actually fit in with php's execution model of each > > request > > being a separate thread / process? As far as I understand this kind > > of > > async programming is only useful within an event-loop architecture > > as > > used by nodejs for example. There are things that do this for php > > like > > We also have functionality in Curl and some DB drivers that could > execute several queries at once, in parallel, and gather the result. > Its essentially the same thing but applied to specific events. It may > make sense to generalize it - i.e. if you had some process like HTTP > request and you wanted to do curl_multi_exec() but in your code - > you'd probably want some way to easily do that... There would be lots of value in a common framework for that. For a user it would be nice to send curl requests, database queries etc. and define the continuation routines in a common way, so that those things can be composed. > Not sure how to do technical details, > as I didn't think in depth about it, but by itself the concept does > not > contradict the PHP execution model... It is contrary in the sense that hack's approach depends on an event loop. This has impact on all code written. Alternative approaches are possible, like a future-based approach combined with a blocking wait, which gives the control to the user might fit more into PHP's current model. johannes