Re: [RFC] Square brackets shortcut

From: Date: Fri, 11 Jan 2008 15:06:52 +0000
Subject: Re: [RFC] Square brackets shortcut
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-34731@lists.php.net to get a copy of this message
a) Commit square bracket array shortcut patch keys and values are separated by colons. ( http://www.opendogs.org/pub/php-5.3dev-080109-sbar.patch ) e.g. $a = [1, 2, 3]; $b = ['foo': 'orange', 'bar': 'apple', 'baz': 'lemon'];
Breaks from PHP's => for no apparent reason (one character too many character this time?), which is just confusing (that's an implicit -1).
b) Commit square bracket array shortcut patch keys and values are separated by double arrows. ( http://www.opendogs.org/pub/php-5.3dev-080109-sbar2.patch ) e.g. $a = [1, 2, 3]; $b = ['foo' => 'orange', 'bar' => 'apple', 'baz' => 'lemon'];
Breaks backwards compatibility to save typing five characters. See above. -1.
c) Reject and keep using `array()'. e.g. $a = array(1, 2, 3); $b = array('foo' => 'orange', 'bar' => 'apple', 'baz' => 'lemon');
For all the above reasons, +1.
In my post i not write about variant "a)" +1 too.

« previous php.internals (#34731) next »