Re: [RFC] Square brackets shortcut
| From: | Eric Coleman | Date: | Sun, 17 Feb 2008 18:31:32 +0000 |
| Subject: | Re: [RFC] Square brackets shortcut | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-35543@lists.php.net to get a copy of this message | ||
+1
I hope this didn't die; As a developer, I really like to use this syntax, and find it preferably from working with javascript, ruby, python, etc.
Regards,
Eric
On Jan 21, 2008, at 12:36 AM, taylor luk wrote:
+1 firstly, square brackets are natural short cut to array(...) that you can find in many many language, one may argue this is merely a minor addition. however, PHP is already a very verbose compare to other language, syntactic improvements adds up it allows us to create much more readable code. someone raise up the readability issue of nested array, this is not a language issue, but rather programming style issue. its up to you to make it clean or verbose as you want it to be. yes, associative array may can look awkward. [] is just a short cut, there is nothing stopping you mix and match. $lists = array( 'first' => [ 1, 2 ,3, 4 ] , 'second' => [ 45, 33, 19 ] ); Lastly, one may again argue this will introduce extra workload for tester, commiter, patchers. This is a new addition to the language, there is no Backward compatibility issue. This isn't a technical issue, but rather management issue. PHP On the language design level hasn't been making much progress, PHP needs to move forward. proper closure, GC, and this. On Jan 20, 2008 2:26 PM, Darius Jahandarie <djahandarie@gmail.com> wrote:Antony Dovgal wrote:--Best Regards, Taylor lukOn 10.01.2008 13:07, Ryusuke SEKIYAMA wrote:Eh, that would just come out as [ 0 => "str", "str" => 1 ] Not too problematic in my mind. +1 for square brackets. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.phpHello, lists, I'm tired to type "array()" many times.-1 The parser in my head is unable to parse this: <?php $var=["str"]; $var["str"]=1; ?>