Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:84226 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 90105 invoked from network); 3 Mar 2015 10:55:12 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Mar 2015 10:55:12 -0000 Authentication-Results: pb1.pair.com header.from=me@kelunik.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=me@kelunik.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain kelunik.com from 81.169.146.161 cause and error) X-PHP-List-Original-Sender: me@kelunik.com X-Host-Fingerprint: 81.169.146.161 mo4-p00-ob.smtp.rzone.de Received: from [81.169.146.161] ([81.169.146.161:13226] helo=mo4-p00-ob.smtp.rzone.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id FA/63-03783-F0395F45 for ; Tue, 03 Mar 2015 05:55:12 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1425380108; l=3617; s=domk; d=kelunik.com; h=Content-Type:Cc:To:From:Subject:Date:References:In-Reply-To: MIME-Version; bh=4d2uQU0HdrgaMB94MxCZXqoBbcdoya72k2oJdmhAfvE=; b=kuIvV3Fc0nyE9O10K+0p9tU++DbOQlT2SqKsI6nYZGF44nP45KYN7xJsePN6CwL8d+6 GjvE8pUCTO0zO0neaqCrkvzGZbuiH/HDUzD4eACh3XU6Nuo9FN2Qg9WQNLJQUe6jNl1u4 lOAmRJpGjgcB0kJqchVcKbBH4mF2s3vBts4= X-RZG-AUTH: :IWkkfkWkbvHsXQGmRYmUo9mls2vWuiu+7SLGvomb4bl9EfHtOnA6 X-RZG-CLASS-ID: mo00 Received: from mail-wg0-f53.google.com ([74.125.82.53]) by smtp.strato.de (RZmta 37.3 AUTH) with ESMTPSA id U002e3r23At8GvR (using TLSv1.2 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) for ; Tue, 3 Mar 2015 11:55:08 +0100 (CET) Received: by wghb13 with SMTP id b13so39160263wgh.0 for ; Tue, 03 Mar 2015 02:55:08 -0800 (PST) MIME-Version: 1.0 X-Received: by 10.194.178.161 with SMTP id cz1mr69344899wjc.102.1425380108625; Tue, 03 Mar 2015 02:55:08 -0800 (PST) Received: by 10.27.77.131 with HTTP; Tue, 3 Mar 2015 02:55:08 -0800 (PST) In-Reply-To: References: Date: Tue, 3 Mar 2015 11:55:08 +0100 Message-ID: To: Rowan Collins Cc: Daniel Lowrey , "internals@lists.php.net" Content-Type: multipart/alternative; boundary=089e0141ab360b74540510602b20 Subject: Re: [PHP-DEV] [RFC Discuss] Generator Delegation From: me@kelunik.com (Niklas Keller) --089e0141ab360b74540510602b20 Content-Type: text/plain; charset=UTF-8 > > Gr, top-posting... Sorry, was on mobile. ;-) However, since the existence of the word "yield" is the only thing that > marks a coroutine now, how about using a variant of that for the final > value, e.g. "yield final $foo"? What's the final value? The last "yield"ed value or a return? Just to give you some real world example: If you're using "return", it would look like that: public function getSession ($sessionId) { $result = yield $this->redis->get("session.{$sessionId}")); // We're waiting here until redis responded. return json_decode($result); } Currently, it looks like this: public function getSession ($sessionId) { $result = yield $this->redis->get("session.{$sessionId}")); yield json_decode($result); } Or maybe even that: public function getSession ($sessionId) { $result = yield $this->redis->get("session.{$sessionId}")); yield "return" => json_decode($result); } I think having the possibility for a return here, would make that code a lot easier to read and understand. Regards, Niklas --089e0141ab360b74540510602b20--