On Thu, 2008-01-10 at 16:18 +0200, Giedrius D wrote: > Hi, > > On Jan 10, 2008 3:56 PM, Hannes Magnusson <[EMAIL PROTECTED]> wrote: > > So you reject scalar type hinting because it isn't type casting and > > can therefor confuses newbies - but scattering seemingly random > > brackets around your code (to safe 5 key strokes) is obvious to users? > > > > Noone would confuse this with named arguments? > > Why can't I do function foo([] $array) {} ? > Can you do function foo(array() $array) {} ? > > > > > foo([]); > > $var = []; > > Is this really readable? > Looks readable to me ;-)
I really like $var = []; but I don't like foo([]) at all. > FWIW if it's going to be implemented I think (b) should be the choice > as it is more consistent with current syntax even though I like (a) > more. > > > > > Are you really serious about this? > > > > -Hannes > > > > > > > > On Jan 10, 2008 11:19 AM, Marcus Boerger <[EMAIL PROTECTED]> wrote: > > > Hello Ryusuke, > > > > > > I like b) ! > > > > > > marcus > > > > > > > > > Thursday, January 10, 2008, 11:07:36 AM, you wrote: > > > > > > > Hello, lists, > > > > > > > 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. > > > > > > > Stanislav, > > > > Sorry, I'm new in this list and I didn't know about past > > > > discussion. As Marcus says, I'd like to ask around again. > > > > > > > > > > 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']; > > > > > > > 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']; > > > > > > > c) Reject and keep using `array()'. > > > > e.g. > > > > $a = array(1, 2, 3); > > > > $b = array('foo' => 'orange', 'bar' => 'apple', 'baz' => 'lemon'); > > > > > > > These patches include the tests. > > > > > > > Which do you like? I like (a) the best. > > > > > > > > > > Regards, > > > > > > > > > > 2008/1/6, Marcus Boerger <[EMAIL PROTECTED]>: > > > >> Hello Stanislav, > > > >> > > > >> tha makesw three then already, how about we ask around again? > > > >> Ryusuke, can you please start a new '[RFC] Square brackets shortcut' > > > >> thread > > > >> to collect opinions and pass along the patch for that? > > > >> > > > >> I like the anonymous function patch too. It is clean and simple. Maybe > > > >> you > > > >> want to start a second '[RFC] Anonymous functions' thread with that > > > >> patch. > > > >> > > > >> Can you also please add tests for both? > > > >> > > > >> marcus > > > >> > > > >> Wednesday, January 2, 2008, 7:51:06 PM, you wrote: > > > >> > > > >> >> the square bracket array syntax patch for PHP 5.3, > > > >> >> http://www.opendogs.org/pub/php-5.3dev-080101-sbar.patch > > > >> > > > >> > I remember we discussed that already and it was rejected then (even > > > >> > though myself and Andi liked it) - did the people that objected then > > > >> > change their minds? > > > >> > > > >> > > > >> > > > >> Best regards, > > > >> Marcus > > > >> > > > >> > > > > > > > > > > -- > > > > /** > > > > * Ryusuke SEKIYAMA > > > > * [EMAIL PROTECTED] > > > > */ > > > > > > > > > > > > > > > Best regards, > > > Marcus > > > > > > > > > -- > > > PHP Internals - PHP Runtime Development Mailing List > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > > > -- > > PHP Internals - PHP Runtime Development Mailing List > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > Regards, > Giedrius > -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php