Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:5242 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 25833 invoked by uid 1010); 5 Nov 2003 17:19:21 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 25739 invoked from network); 5 Nov 2003 17:19:20 -0000 Received: from unknown (HELO amf.hotels-on-air.de) (217.194.75.126) by pb1.pair.com with SMTP; 5 Nov 2003 17:19:20 -0000 Received: from steph2 ([10.10.30.149]) by amf.hotels-on-air.de (8.12.3/8.12.3/SuSE Linux 0.6) with ESMTP id hA5HJJO0018559; Wed, 5 Nov 2003 18:19:19 +0100 Reply-To: To: "Christian Schneider" , Date: Wed, 5 Nov 2003 17:25:42 -0000 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) In-Reply-To: <20031104233306.34859.qmail@pb1.pair.com> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 Importance: Normal X-Virus-Scanned: by amavis-milter (http://amavis.org/) Subject: RE: [PHP-DEV] Proposal: Array syntax From: steph.fox@virgin.net ("Steph") References: <20031104233306.34859.qmail@pb1.pair.com> OK .. I'm a wobbler. I think it would be cool to have the cleaner alternative syntax; I think I'd use it *in some situations and not others*, and I think that that in itself would make my code virtually unmaintainable by anyone else. As Andi originally said, having more than one way to do things isn't always a good thing. Add me to the -1 list. Even tho' it's a cool idea. - Steph > -----Original Message----- > From: Christian Schneider [mailto:cschneid@cschneid.com] > Sent: 04 November 2003 23:33 > To: internals@lists.php.net > Subject: [PHP-DEV] Proposal: Array syntax > > > I propose to add an alternative (backward compatible) short array > creation syntax: > $a = [ 1, 2, 3 ]; and $a = [ 'a' => 42, 'b' => "foo" ]; > > It can also be used in function calls: > img(['src' => "logo.gif", 'alt' => "Logo"]); > > Reason behind this change: Arrays are used a lot and should therefore > have as little syntactic overhead as possible. And I think the short > syntax is also easier to read and write. > > A patch for the parser is trivial and is attached for Zend2. > > Note: I checked the newsgroup archive but couldn't find a discussion > about this. After not hearing back about my proposed enhancement to > debug_backtrace() and the dangling comma for function call parameters > being rejected I wonder if I'm using the right mailing list for this :-) > > - Chris >