Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:61759 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 6842 invoked from network); 25 Jul 2012 13:27:37 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 Jul 2012 13:27:37 -0000 Authentication-Results: pb1.pair.com header.from=theanomaly.is@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=theanomaly.is@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.217.170 as permitted sender) X-PHP-List-Original-Sender: theanomaly.is@gmail.com X-Host-Fingerprint: 209.85.217.170 mail-lb0-f170.google.com Received: from [209.85.217.170] ([209.85.217.170:55117] helo=mail-lb0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C3/14-19281-844FF005 for ; Wed, 25 Jul 2012 09:27:37 -0400 Received: by lbgc1 with SMTP id c1so675907lbg.29 for ; Wed, 25 Jul 2012 06:27:33 -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=XWWgC8ioHOXZ8NvlrWdXePRZNS97rr0KB7ZPct+XFxQ=; b=Qe7YlkApNUxso5s/zy2T6t/WLMv4kmW7eHJmwPIT7vSeRvYeHkMbL117aZgz+x5Lb6 MOdFKJboOmp+jBm60NanBgHWdBY5GNHOscVGdM2PZpiEcsX8Z3maGt5hTM2lQ21pBbd+ xRPD1QarvTmmrpwy0rRCcCh5VL+yE6mWUFi8YCQSdJEhkVEQLv5uDKCcG5GznhKNA0M6 eqMNnlRDz4sG1rTg/InQ40H07IiNVyqr7DOayeGm4H6br7fq1Zh9twqrgkHidX7qFY28 xBzqMyr712J6ciqA5VDWBHS1cuTeEU8SFQ7lCKNzI9LBBiCeEdjpX/ZsbEXsoz+EgPcK 7XbQ== MIME-Version: 1.0 Received: by 10.112.83.228 with SMTP id t4mr11995220lby.74.1343222853779; Wed, 25 Jul 2012 06:27:33 -0700 (PDT) Received: by 10.112.26.234 with HTTP; Wed, 25 Jul 2012 06:27:33 -0700 (PDT) In-Reply-To: References: <500EDCC7.1020402@ajf.me> <500EE3B9.8010902@ajf.me> <500EEA76.1030407@ajf.me> Date: Wed, 25 Jul 2012 09:27:33 -0400 Message-ID: To: Alex Aulbach Cc: PHP internals Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [PHP-DEV] Re: Generators in PHP From: theanomaly.is@gmail.com (Sherif Ramadan) > > Again: I don't have any problems with the object returning. :) > > I see a problem that the mechanism isn't understood and used wrong. > Isn't understood by who? Used wrong by who? Are we talking about people using a feature, that doesn't exist yet in PHP, the wrong way and arguing that there is an apparent lack of understanding of this non-existent features among the user-base? I'm sorry, I really don't follow this train of thought. > And I think, that it is too easy to oversee that it is not a "normal" > PHP-function, because the "yield" is normaly in the middle of the code > and "return" at the end. > The only thing that's not normal here is the flow of control being passed back and forth between the generator and the function > Both couldn't be changed. But it could help, if you name different > things different. What do you want to name it? If it's a function definition it clearly should be called a function in order to remain inline with the existing PHP code out there. Otherwise you're adding more confusion. The fact that the function contains a "yield" shouldn't change the fact that it's still a function. I agree it behaves differently, but the same could be argued about functions that call other functions or even functions that call themselves. The flow of control there isn't always obvious from static code analysis, but that's what the runtime environment is there to aid the developer with. How is changing the name going to aid the developer's understanding of generators any better? I doubt this adds any real value here aside from pointing out the already obvious "this function contains a yield". > > ... I have no problem > with it, I use PHP every day, but as explained most PHP-developers > will have problems and I can say that, because I've more than 20 years > experience in that. Do you have that? > 20 years experience in PHP? No, I believe it only ever appeared publicly about 17 years ago. 20 years experience with developers that have problems? Yes, there's no shortage of them.