Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:37994 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 17977 invoked from network); 29 May 2008 12:49:18 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 29 May 2008 12:49:18 -0000 Authentication-Results: pb1.pair.com smtp.mail=helly@php.net; spf=unknown; sender-id=unknown Authentication-Results: pb1.pair.com header.from=helly@php.net; sender-id=unknown Received-SPF: unknown (pb1.pair.com: domain php.net does not designate 85.214.94.56 as permitted sender) X-PHP-List-Original-Sender: helly@php.net X-Host-Fingerprint: 85.214.94.56 aixcept.net Linux 2.6 Received: from [85.214.94.56] ([85.214.94.56:51818] helo=h1149922.serverkompetenz.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 49/D2-03918-D46AE384 for ; Thu, 29 May 2008 08:49:18 -0400 Received: from MBOERGER-ZRH (unknown [81.211.8.2]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by h1149922.serverkompetenz.net (Postfix) with ESMTP id BF25D11EFE2; Thu, 29 May 2008 14:49:14 +0200 (CEST) Date: Thu, 29 May 2008 14:49:14 +0200 Reply-To: Marcus Boerger X-Priority: 3 (Normal) Message-ID: <104939377.20080529144914@marcus-boerger.de> To: Sebastian Deutsch CC: internals@lists.php.net In-Reply-To: <97.F8.15519.1229C384@pb1.pair.com> References: <0412F6FE505049F7901EAB8C61774839@pc> <87.77.15519.9E47C384@pb1.pair.com> <97.F8.15519.1229C384@pb1.pair.com> MIME-Version: 1.0 Content-Type: text/plain; charset=windows-1251 Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] Re: Short syntax for array literals [...] From: helly@php.net (Marcus Boerger) Hello Sebastian, -1, right now we have [] only in read context. And an array will be constructed with 'array' keyword. Loosing this distinction is a bit of a draw back for me. marcus Wednesday, May 28, 2008, 12:58:24 AM, you wrote: > 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 Best regards, Marcus