Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:88535 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 2674 invoked from network); 28 Sep 2015 22:05:45 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 28 Sep 2015 22:05:45 -0000 Authentication-Results: pb1.pair.com smtp.mail=aaron@icicle.io; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=aaron@icicle.io; sender-id=pass Received-SPF: pass (pb1.pair.com: domain icicle.io designates 199.38.81.6 as permitted sender) X-PHP-List-Original-Sender: aaron@icicle.io X-Host-Fingerprint: 199.38.81.6 mercury.negativeion.net Received: from [199.38.81.6] ([199.38.81.6:57983] helo=mercury.negativeion.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C9/72-17200-6B9B9065 for ; Mon, 28 Sep 2015 18:05:42 -0400 Received: from localhost (localhost [127.0.0.1]) by mercury.negativeion.net (Postfix) with ESMTP id B736C2D4FBC0; Mon, 28 Sep 2015 18:05:38 -0400 (EDT) X-Virus-Scanned: amavisd-new at negativeion.net Received: from mercury.negativeion.net ([127.0.0.1]) by localhost (mercury.negativeion.net [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id kjOMNb59tEMe; Mon, 28 Sep 2015 18:05:38 -0400 (EDT) Received: from macpro.local (unknown [173.225.158.77]) by mercury.negativeion.net (Postfix) with ESMTPSA id C84BE2D4FBAF; Mon, 28 Sep 2015 18:05:37 -0400 (EDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2098\)) In-Reply-To: Date: Mon, 28 Sep 2015 17:05:36 -0500 Cc: PHP Internals , thruska@cubiclesoft.com, Levi Morrison , bjorn.x.larsson@telia.com Content-Transfer-Encoding: quoted-printable Message-ID: <481A1803-DE3D-40F0-BE8D-20BC1D1EDC03@icicle.io> References: To: "S.A.N" X-Mailer: Apple Mail (2.2098) Subject: Re: [PHP-DEV] async/await - is future reserved words in PHP 7.x? From: aaron@icicle.io (Aaron Piotrowski) Hello, > On Sep 28, 2015, at 3:29 AM, S.A.N wrote: >=20 > Are there any future plans for - async/await? > This need to know now, not to use these words to constants, and class = names... >=20 > --=20 > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php >=20 As a few others have pointed out, the idea has certainly been discussed, = but I=E2=80=99m not aware of any real progress toward integrating this = into PHP in the near future. Implementing async/await in PHP is = certainly possible, but will be no small task. I would love to see it in = a 7.x release, but I=E2=80=99m thinking it might have to wait until 8 = just because of all the changes that would be required. I=E2=80=99ve created a library called Icicle = (https://github.com/icicleio/icicle) that uses promises and generators = to implement coroutines that use yield to interrupt execution of the = coroutine until the promise is resolved. Combined with non-blocking I/O = and concurrent execution implementations available in other packages = designed for Icicle, you can create non-blocking and multi-threaded = servers that are designed to be run from the CLI instead of the Apache = SAPI, etc. If you are not familiar with Icicle, I encourage you to take a quick = look at the documentation, as the proceeding paragraph will make more = sense if you understand how Icicle works. I think the engine could use a similar strategy to that of Icicle for = async/await. Async functions could return promises. Calling an async = function with the await keyword would be similar to yielding a promise = (or coroutine) within a coroutine in Icicle. If the await keyword is not = used when calling an async function, this could be similar to calling = Promise::wait() in Icicle, blocking control flow at that point until the = promise is resolved. Perhaps in this way existing functions could be = modified to support async/await while maintaining the existing blocking = behavior when called without the await keyword. Aaron Piotrowski=