Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:61746 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 73103 invoked from network); 25 Jul 2012 08:40:58 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 Jul 2012 08:40:58 -0000 Authentication-Results: pb1.pair.com smtp.mail=theanomaly.is@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=theanomaly.is@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.215.42 as permitted sender) X-PHP-List-Original-Sender: theanomaly.is@gmail.com X-Host-Fingerprint: 209.85.215.42 mail-lpp01m010-f42.google.com Received: from [209.85.215.42] ([209.85.215.42:37496] helo=mail-lpp01m010-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 7A/FD-27263-811BF005 for ; Wed, 25 Jul 2012 04:40:57 -0400 Received: by lago2 with SMTP id o2so366146lag.29 for ; Wed, 25 Jul 2012 01:40:53 -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=n2qzqQ5CMIEfo/OGZ/Ej3sAq2AwVHdWXcIjmOCSy48U=; b=ol7MzLMlOQSXZPKFqjWh4ixTIBx0AtpWu3m95LlEIYZ+W1BSANbFmBQaD2GDyWyq9/ i6tMlq1/hcApNa1Nx/kTXRLGxuwaKs/qJJcJgA2r5FQGuSuWB2V29ePi8eS0H1aVl9C0 3XMra5T447fGEl0jIpSgFjMIUhmqclYSlUH2NEdhZR5VXq8S52yiyECEgF8z2NvM4N4Z JzKqivfujX8+P8zyP6Ed1xAYzAmN3RlWfiXuzSVlUoVqbzPCEL1DjrewPcmFcwuNdu9g Mp3zPYbj2gTOhmW7L21bseAu+Ps0FfTQ+DaaEwKJFPaVpV/DOk2p/RiE1O9dYiHt0xxr HnjA== MIME-Version: 1.0 Received: by 10.112.84.39 with SMTP id v7mr11463435lby.15.1343205653205; Wed, 25 Jul 2012 01:40:53 -0700 (PDT) Received: by 10.112.26.234 with HTTP; Wed, 25 Jul 2012 01:40:53 -0700 (PDT) In-Reply-To: References: <500EDCC7.1020402@ajf.me> <500EE3B9.8010902@ajf.me> <500EEA76.1030407@ajf.me> Date: Wed, 25 Jul 2012 04:40:53 -0400 Message-ID: To: Alex Aulbach Cc: Andrew Faulds , internals@lists.php.net Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [PHP-DEV] Re: Generators in PHP From: theanomaly.is@gmail.com (Sherif Ramadan) > > I like that kind of agile programming, too. > > But if someone like me says "come on, lets make it a little bit more > easy, because returning objects from functions is some kind of > unconventional; many developers will make mistakes here..." - why not? > They will. I can tell by sure. > What are suggesting is going to make this easy that isn't already covered by the RFC? Lets not get caught up in semantics here. The current RFC outlines what appears to be inline with other established implementations. The fact that a function can return an object should be nothing new to PHP. The fact that an object cause some flow of control through a construct, also shouldn't be new to PHP. I don't understand what you find non-conventional about functions or methods that return objects. function foo() { return new bar; } $foo = foo(); That's already a common thing in most PHP code I see. PDO::prepare(), MySQLi::prepare(), DateTime::diff(), also return objects as a result of calling those methods. I don't think very many PHP developers will find this concept difficult to grasp if they can already grasp the aforementioned methods, for example. > > Since I begun reading this mailing list I have the impression, that > there are only PHP-programmers like us out there. But the fact is, > that the most PHP-programmers didn't even read the manuals completly. > You may say "Their fault" "Are they programmers, if they don't?", but > this is first a little bit of ignorance because second this is one of > the best features, that PHP has - this "nicely flow", everybody can do > it. I always think of Bob Ross, when I explain PHP. > Yes, there are people who don't read the manual. This is nothing new or unique to any particular language. Yes, PHP makes it easy for virtually anybody to use. No, not everything in PHP is easy. No, not everybody who can use PHP will find it easy to write good code or to understand all of the language's features at first. What programming language holds this characteristic? From all of the programming languages I've learned over the years PHP is still by far at the top of my list for taking on new features. Just between PHP 5.2 and 5.4 we've gained traits, closures, namespaces, function array derefrencing, access to member upon instantiation, and lots of other lovely additions to the language. I don't see languages like Java or Python evolving this quickly -- by contrast. > > But it's ok, there are no mistakes, there are just happy little accidents. :) > > [means: I will not complain any more] > > -- > Alex Aulbach I didn't take any of that as a complaint. I think if you have an object suggestion (or even subjective one) as to how this can be easier on the end-user of the language it would be important to bring it out now. I was unable to ascertain from the prior discussion thus far.