Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:37922 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 70409 invoked from network); 27 May 2008 22:58:42 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 27 May 2008 22:58:42 -0000 X-Host-Fingerprint: 83.135.104.155 i5387689B.versanet.de Received: from [83.135.104.155] ([83.135.104.155:11161] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 97/F8-15519-1229C384 for ; Tue, 27 May 2008 18:58:42 -0400 Message-ID: <97.F8.15519.1229C384@pb1.pair.com> To: internals@lists.php.net Date: Wed, 28 May 2008 00:58:24 +0200 User-Agent: Thunderbird 2.0.0.14 (Windows/20080421) MIME-Version: 1.0 References: <0412F6FE505049F7901EAB8C61774839@pc> <87.77.15519.9E47C384@pb1.pair.com> In-Reply-To: <87.77.15519.9E47C384@pb1.pair.com> Content-Type: text/plain; charset=windows-1251; format=flowed Content-Transfer-Encoding: 7bit X-Posted-By: 83.135.104.155 Subject: Re: Short syntax for array literals [...] From: sebastian.deutsch@9elements.com (Sebastian Deutsch) fyi - i added a RFC http://wiki.php.net/rfc/shortsyntaxforarrays please add your votes cheers Sebastian Sebastian Deutsch schrieb: > dont have karma - but I would love it! so +1 here. > would it make sense to write an RFC? > > cheers > > Sebastian > > Stan Vassilev | FM schrieb: >> Hi, >> >> I hear this often by other developers and I tend to agree with them, >> that arrays are used often, and often nested, so that having a long >> syntax for array literals tend to produce less legible code than in >> other scriping languages. >> >> $a = array(array(1,2), array(3,4), 5, 6); >> >> $b = array('a' => 1, 'b' =>2); >> >> We use arrays in our configurations, in passing complex parameters to >> functions, fetching information from databases, basically everything. >> So it adds up. >> >> Some frameworks have somewhat funny attempts to remedy this by >> introducing "shortcuts" like this: function a() { return >> func_get-args(); }. Of course this doesn't work when you need to >> specify the key name, and the overhead isn't worth it. >> >> It looks as there may not be a specific reason not to allow the JS >> syntax as an alternative syntax (while keeping the current one in >> parallel): >> >> $a = [[1, 2], [3, 4], 5, 6]; >> >> $b = ['a' => 1, 'b' =>2]; >> >> There shouldn't be confusion to the parser as the brackets aren't >> preceded by an identifier. >> >> Was this discussed before on the list? >> >> Regards, Stan Vassilev