Re: function call chaining
| From: | Alain Williams | Date: | Tue, 19 Jan 2010 22:54:48 +0000 |
| Subject: | Re: function call chaining | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-46830@lists.php.net to get a copy of this message | ||
On Tue, Jan 19, 2010 at 12:09:53PM -0800, Stanislav Malyshev wrote:
> Hi!
>
> >$eep->oop()->ork()->ah()->ah();
> >
> >the newcomer will have to spend significant time rummaging around the
> >source code to figure out what classes are involved.
>
> As opposed to:
> $oop = $eep->oop();
> $ork = $oop->ork();
> $ah = $ork->ah();
> $ah2 = $ah->ah();
>
> where it instantly becomes crystal clear! Come on, this argument of "I
> could read any code without ever knowing anything about anything but you
> feature broke it" is getting really stale. You couldn't, and the feature
> changed nothing.
+1
At least with $eep->oop()->ork()->ah()->ah() you don't have stray/unwanted
variables hanging round to confuse (or be misused) later.
--
Alain Williams
Linux/GNU Consultant - Mail systems, Web sites, Networking, Programmer, IT Lecturer.
+44 (0) 787 668 0256 http://www.phcomp.co.uk/
Parliament Hill Computers Ltd. Registration Information: http://www.phcomp.co.uk/contact.php
Past chairman of UKUUG: http://www.ukuug.org/
#include <std_disclaimer.h>