Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:62281 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 5505 invoked from network); 20 Aug 2012 11:57:55 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Aug 2012 11:57:55 -0000 Authentication-Results: pb1.pair.com header.from=keisial@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=keisial@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.215.170 as permitted sender) X-PHP-List-Original-Sender: keisial@gmail.com X-Host-Fingerprint: 209.85.215.170 mail-ey0-f170.google.com Received: from [209.85.215.170] ([209.85.215.170:61690] helo=mail-ey0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 90/D6-07742-24622305 for ; Mon, 20 Aug 2012 07:57:54 -0400 Received: by eaao11 with SMTP id o11so1741976eaa.29 for ; Mon, 20 Aug 2012 04:57:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=u7NrVeUmrDX6CQtbxUfhZyu21ltZ+AAFOJ6lqpO6+Jk=; b=Cw7ZWA6xPgkYIxXQKuJZkCtZhDrtA8N5iouDeYhfHqMEiGva4p7PiTeGAJMN2QyMZt Yos5ztgubsdYoSDacscnm4uivafx3D93bz5nfZvGijkFrunB2sM6yQbdET4Q2lZgpBeU RtZIHlSpfi9OvBhqFb4d/VzqPwrnKvWv0s0CuRZRZ6dF/AopZMoWcHjcvIib96Fdemlt gaHRqvvqgSvitWYyOBSdBzdNK1mtGXUtD/R8YXu168EqnoGXaxZTBuZAkEUNU2iXPZlc 5FUMuQwjauTj1fDlQ2gVo3xI5uQyul3hl5X/AWb0NdllrZ3A2Odbu1G8j0kL3z7l4NQr D1/A== Received: by 10.14.213.137 with SMTP id a9mr8364971eep.38.1345463868810; Mon, 20 Aug 2012 04:57:48 -0700 (PDT) Received: from [192.168.1.26] (16.Red-83-49-113.dynamicIP.rima-tde.net. [83.49.113.16]) by mx.google.com with ESMTPS id y1sm41343636eel.0.2012.08.20.04.57.46 (version=SSLv3 cipher=OTHER); Mon, 20 Aug 2012 04:57:48 -0700 (PDT) Message-ID: <503225D8.4040900@gmail.com> Date: Mon, 20 Aug 2012 13:56:08 +0200 User-Agent: Thunderbird MIME-Version: 1.0 To: Rasmus Lerdorf CC: Stas Malyshev , Derick Rethans , Nikita Popov , PHP internals References: <503171CB.3090609@sugarcrm.com> <50317E51.4090305@lerdorf.com> In-Reply-To: <50317E51.4090305@lerdorf.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [RFC] Generators From: keisial@gmail.com (=?ISO-8859-1?Q?=C1ngel_Gonz=E1lez?=) On 20/08/12 02:01, Rasmus Lerdorf wrote: > I would still like to understand what this generator keyword would > actually do. I don't see how it would work. Would a function marked > generator somehow not be allowed to return normally or to finish and not > return anything? How could this be enforced? I am completely against any > keyword that is essentially documentation-only. > > -Rasmus Given that such function could "return several times", seems a different enough function type to have its keyword. You could not decorate it and rely instead on the presence of the yield keyword, but parsers will thank knowing about it from the start rather than realising at mid-parsing that the function is a completely different beast. Regards