Hi!

I don't mind the foo()() syntax, especially now that we have closures.
But people are right, we have a longstanding feature request for
$foo()[0] as well, so if we start down this path of adding chaining, we
should do that one as well and see if any others make sense.

As I said, that was next on my TODO (which doesn't make a promise of delivering it soon, that depends on so many external circumstances :)

Not sure the {} expression syntax is needed.  What sort of expressions
do you see being useful here that would need the braces?  Stuff like
$a[$idx]() works today without needing any extra syntax.  Are you

This is one of the reasons why I wanted to have ()() to work - you can do $myMethods['foo']() but as soon as you go from that to getMyMethod('foo') you have to have temp vars. It's an ugly style.

thinking along the lines of:

{strtolower($a[$idx])}()

No, that is probably not very useful or nice. Only use I'd see as interesting would be either distinguishing between $foo->method() and ($foo->propertyContainingClosure)() and alike.

or something like that?  That would make the "I hate linefeeds and
semi-colons" crowd happy, I guess.

That's more about extra statements than about linefeeds and semicolons. People like to speak in full expressive sentences, not. In chunks. Each of which. Expresses only small. Part of. The whole meaning. Of the sentence. You can feel the difference, right?

I, personally, felt the need to do ()() as soon as I started playing with closures, since when you do that, you very soon having functions returning closures, and that very soon leads to needing to call whatever function fetching closure returned. Of course, you can get too far with it, just as you can get too far with run-on sentences. Just as in prose, one has to watch his style.
--
Stanislav Malyshev, Zend Software Architect
s...@zend.com   http://www.zend.com/
(408)253-8829   MSN: s...@zend.com

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to