Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:34647 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 17553 invoked by uid 1010); 10 Jan 2008 14:41:49 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 17537 invoked from network); 10 Jan 2008 14:41:49 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 10 Jan 2008 14:41:49 -0000 Authentication-Results: pb1.pair.com smtp.mail=sam@sambarrow.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=sam@sambarrow.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain sambarrow.com from 205.234.132.11 cause and error) X-PHP-List-Original-Sender: sam@sambarrow.com X-Host-Fingerprint: 205.234.132.11 scottsdale.servershost.net Received: from [205.234.132.11] ([205.234.132.11:38261] helo=scottsdale.servershost.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 89/37-59671-DAE26874 for ; Thu, 10 Jan 2008 09:41:49 -0500 Received: from [98.172.154.66] (port=11527 helo=[10.200.100.14]) by scottsdale.servershost.net with esmtpsa (SSLv3:RC4-MD5:128) (Exim 4.68) (envelope-from ) id 1JCybK-0000uy-G3; Thu, 10 Jan 2008 08:41:46 -0600 To: Hannes Magnusson Cc: Marcus Boerger , Ryusuke SEKIYAMA , internals@lists.php.net, Stanislav Malyshev In-Reply-To: <7f3ed2c30801100556y14b27d5es24eb8865b9f330e2@mail.gmail.com> References: <1665325616.20080110111902@marcus-boerger.de> <7f3ed2c30801100556y14b27d5es24eb8865b9f330e2@mail.gmail.com> Content-Type: text/plain Date: Thu, 10 Jan 2008 09:39:28 -0500 Message-ID: <1199975968.25972.7.camel@sbarrow-desktop> Mime-Version: 1.0 X-Mailer: Evolution 2.10.1 Content-Transfer-Encoding: 7bit X-Antivirus-Scanner: Clean mail though you should still use an Antivirus X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - scottsdale.servershost.net X-AntiAbuse: Original Domain - lists.php.net X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - sambarrow.com X-Source: X-Source-Args: X-Source-Dir: Subject: Re: [PHP-DEV] [RFC] Square brackets shortcut From: sam@sambarrow.com (Sam Barrow) On Thu, 2008-01-10 at 14:56 +0100, Hannes Magnusson 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) {} ? > > foo([]); > $var = []; > Is this really readable? > > Are you really serious about this? I don't think the only benefit in this would be to save keystrokes. I think it looks better, and makes code more readable, whereas the current way just looks like a function call. > -Hannes > > > On Jan 10, 2008 11:19 AM, Marcus Boerger 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 : > > >> 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 > > > * rsky0711@gmail.com > > > */ > > > > > > > > > > Best regards, > > Marcus > > > > > > -- > > PHP Internals - PHP Runtime Development Mailing List > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > >