On 10 Jan 2008, at 10:07, Ryusuke SEKIYAMA wrote:

I'm tired to type "array()" many times. And I want to
declare arrays more easily. So I wrote the patch for
zend_language_parser.y which enables to declare arrays
with square brackets like some other languages.

I don't think tiredness to type an extra five characters should be an excuse to change the syntax. There are language specifically designed to require the minimum number of characters to be typed — if this is a real concern, you'd be better off using one of them and not PHP.

There are three options:

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.



--
Geoffrey Sneddon
<http://gsnedders.com/>

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

Reply via email to