Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:62272 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 31213 invoked from network); 20 Aug 2012 00:01:28 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Aug 2012 00:01:28 -0000 Authentication-Results: pb1.pair.com header.from=rasmus@lerdorf.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=rasmus@lerdorf.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain lerdorf.com from 209.85.220.170 cause and error) X-PHP-List-Original-Sender: rasmus@lerdorf.com X-Host-Fingerprint: 209.85.220.170 mail-vc0-f170.google.com Received: from [209.85.220.170] ([209.85.220.170:43531] helo=mail-vc0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 2E/9A-03087-75E71305 for ; Sun, 19 Aug 2012 20:01:28 -0400 Received: by vcbgb30 with SMTP id gb30so5168180vcb.29 for ; Sun, 19 Aug 2012 17:01:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:x-enigmail-version:content-type :content-transfer-encoding:x-gm-message-state; bh=LlMVE5F0rp3eyEVKaBtUXLbeeROeVMnKJzG0chh6udg=; b=p2dbUw5f3EzX/vLaEbw4+EZ/Iiv3b8SbOU8hdjDMR8iSe3mG5sirKXRk9/kkjcosWT yIkYczgwHMxnB4+m2OoeVDuPQNJF7LCKofrOwh91xt4ClwwCQa61+2eY42oDxMDZHoPW RCVQWqtnmKiqTu1c9Qu/90R+RVQ01w6P20XYvGF9O474KMQtn3RorR4K49c7Nyh6JdOY 4xU8SuBzVzdptziRmroW3NoXd1hwEZjiBWA/mY+oi0Btizgcaw3EdhCcX7OXhWo4NVmy CQ1rAFvBGMP4Kldcky3fx4hbIe37GELG2JeWipOJd7FMk1PuuRi8biJHGOiRhn825nKs vRHw== Received: by 10.52.36.33 with SMTP id n1mr7386467vdj.27.1345420884560; Sun, 19 Aug 2012 17:01:24 -0700 (PDT) Received: from [192.168.2.140] (CPE00131063dcac-CM0011aec551ea.cpe.net.cable.rogers.com. [174.113.209.222]) by mx.google.com with ESMTPS id xk2sm3631156vec.13.2012.08.19.17.01.23 (version=SSLv3 cipher=OTHER); Sun, 19 Aug 2012 17:01:23 -0700 (PDT) Message-ID: <50317E51.4090305@lerdorf.com> Date: Sun, 19 Aug 2012 20:01:21 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120714 Thunderbird/14.0 MIME-Version: 1.0 To: Stas Malyshev CC: Derick Rethans , Nikita Popov , PHP internals References: <503171CB.3090609@sugarcrm.com> In-Reply-To: <503171CB.3090609@sugarcrm.com> X-Enigmail-Version: 1.5a1pre Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Gm-Message-State: ALoCoQmDbSIG5Q3/F2InvKlcvrKUT95Czy3zWN4q4JByfS71qMzYkOq/C4tMBVGW+wv0EYAvZ6xi Subject: Re: [PHP-DEV] [RFC] Generators From: rasmus@lerdorf.com (Rasmus Lerdorf) On 08/19/2012 07:07 PM, Stas Malyshev wrote: > Hi! > >> I am against this. This is even more magic in PHP. Is it really that >> difficult to have to mark the function with a different keyword, such as >> "generator": > > You have a point here, but "public static final generator function > foo()" sounds a bit long-winded to me... Also, we'd have then to decide > which function can be marked generator and which can't (e.g., interface > probably can't, abstract probably can't, anonymous probably can, etc.) > which adds more complexity. > > Also, I think that people that complain about having to scan through > huge functions to see if they're generators or not, forget one thing: > documentation. Yes, there is a way to make the purpose of the function > understandable to a human without having him to do computer's work. > That's documentation. Undocumented code is broken code. Broken code is > not a good example when we're talking about right design. 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