Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:61724 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 91385 invoked from network); 24 Jul 2012 19:13:42 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 Jul 2012 19:13:42 -0000 Authentication-Results: pb1.pair.com smtp.mail=alex.aulbach@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=alex.aulbach@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.213.42 as permitted sender) X-PHP-List-Original-Sender: alex.aulbach@gmail.com X-Host-Fingerprint: 209.85.213.42 mail-yw0-f42.google.com Received: from [209.85.213.42] ([209.85.213.42:47553] helo=mail-yw0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 1B/85-01267-5E3FE005 for ; Tue, 24 Jul 2012 15:13:41 -0400 Received: by yhoo21 with SMTP id o21so8066414yho.29 for ; Tue, 24 Jul 2012 12:13:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=FiYc/xxQSYTeLhPVbHdHq4gJ67KHTO3C/fkGjYxEfx4=; b=Z3vh+vbRCbSYSKPwQIJMPaSu57jdR1jus6az+UBouPGtsjxWpnjYo2pZV0i0FQC7Rx YTFSTupp5FjAQCpd9mePLNOaxkzvmqp6VjWkcUaC9PANWJGSX6pKEKFUbyH6rp/wKE/q WqgmiPrNePI7t3qW5SXpDu7/KDzYJyFbCMg4YmRQidZ5+9QOAETvNkTBOqBLZ9MqMwwg ZgnYPxbjII/PSibjKHg43sxaIHeJ1krmG2g8WL9V751k56UvijUXDmvD2p8eEXMsuymW BhnN+3sdUiOyb/hbXV7+DXLzO3DCniU82Z0QOSy6h3vvjPuA7cv0IAI3sd0VC5yuUajJ WkZQ== MIME-Version: 1.0 Received: by 10.68.237.105 with SMTP id vb9mr46849980pbc.103.1343157218215; Tue, 24 Jul 2012 12:13:38 -0700 (PDT) Received: by 10.68.31.7 with HTTP; Tue, 24 Jul 2012 12:13:38 -0700 (PDT) In-Reply-To: References: <500EDCC7.1020402@ajf.me> Date: Tue, 24 Jul 2012 21:13:38 +0200 Message-ID: To: Gustavo Lopes Cc: Yahav Gindi Bar , internals@lists.php.net Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [PHP-DEV] Re: Generators in PHP From: alex.aulbach@gmail.com (Alex Aulbach) 2012/7/24 Gustavo Lopes : > When you have function foo() { ... yield /* ... */; ... } and > you call foo(), you get the same thing every time: a Generator object. It so > happens that the implementation of that object is inside the body of the > function. Hmmm. It's not that I didn't understand it. :) My thoughts are about usage in practice. Ok, my first argument with the developer, who overtakes an old project was weak. What about situations, when developers with different knowlegde work together? Or when you have programming errors, when you write function blubb() { ... yields... ... ... return.... } (you may only see the "return"). And many those situations are thinkable, because this kind of PHP function works so totally different from current. > Maybe this helps you reason about the feature. Please understand me, it's not that I don't like it or that I couldn't live with it. It's because I have too much experience what could happen if new programming features are introduced. For example: Exceptions in PHP are quite old now. And the concept of exceptions should be known. But I worked together with programmers wich produced code like ... try { $value = method_which_throws_exceptions(); } catch (...) { return $value; } return $value; ... And he has it done, although I wrote some example code for him how to use exceptions in this context!!11! THAT'S the reality. We can ignore that, but I just want to make such simple mistakes not so easy and the afford is worth the results. You can argue: "Those mistakes will always happen". I say "Yes, of course, but if we have the chance to reduce those mistakes we should do it." -- Alex Aulbach