Re: function call chaining
| From: | Stanislav Malyshev | Date: | Tue, 19 Jan 2010 19:32:02 +0000 |
| Subject: | Re: function call chaining | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-46827@lists.php.net to get a copy of this message | ||
Hi!
Sure. But one needs to understand the language. Otherwise the reader needs to go hunting around a dictionary (or in our case, the source code) to figure out what the heck the person (code) is trying to say (do). Chaining produces code that is not self-documenting.If you don't understand the language, nothing is self-documenting. If you have the basics, you'd be able to understand that if foo()+1 means "take result of foo() and add one", then foo()() would be "take result of foo() and call it as a function". Adding temp var would be just like writing $number = foo(); $number_plus_one = $number+1; - excessive verbosity with no added value. It's like writing comments in style of: foo(); // call foo() - surely it's documented, but not useful in any way. -- Stanislav Malyshev, Zend Software Architect stas@zend.com http://www.zend.com/ (408)253-8829 MSN: stas@zend.com