Richard Lynch schrieb:
On Thu, November 9, 2006 9:13 pm, Andi Gutmans wrote:
<?php
function foo()
{
return array(1,2,3,4,5,6);
}
echo foo()[4]; // <---- it that
It looks a bit perl-ish indeed but I don't see much trouble
in having that it people really need it...
-0.3
:-)
The thing is, I see this ending up with people starting to write
unintelligible code:
echo {$$(foo()[4])}()[17][13];
The 4th element of the return array from foo() is a function name
which returns a 2-D array...
And, honestly, if you write code like that in the first place, you
ought to be shot. :-)
Saving a few keystrokes is nifty, but it ends up costing far more in
maintenance than its worth in this proposed syntax, imho.
'Course, I don't *have* to use it, so I just won't do that, but I'll
end up having to maintain/fix somebody else's mess that DID use it,
which is where the -0.3 comes from. If the code is too messed up with
this kind of junk, I just won't take the job. I'd rather flip burgers
than work on code like this. :-)
Well, I think, a language has to support every coding. It should be the
job of a good programmer to write code, that can be maintained in an
easy way. That is not the job of the language. A good language supports
the developer in writing clean code, it does not bind him.
I like the possibilities of this syntax and I can imagine, that using
this style can improve some codes (p.e. in helper-classes).
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php