Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:55771 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 14883 invoked from network); 10 Oct 2011 09:03:47 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 10 Oct 2011 09:03:47 -0000 Authentication-Results: pb1.pair.com header.from=tyra3l@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=tyra3l@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.213.42 as permitted sender) X-PHP-List-Original-Sender: tyra3l@gmail.com X-Host-Fingerprint: 209.85.213.42 mail-yw0-f42.google.com Received: from [209.85.213.42] ([209.85.213.42:37151] helo=mail-yw0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id AE/B1-04654-1F4B29E4 for ; Mon, 10 Oct 2011 05:03:46 -0400 Received: by ywa8 with SMTP id 8so5939843ywa.29 for ; Mon, 10 Oct 2011 02:03:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=hMgWnhWy8mWgeOYH9slJd8+PU9pGwoTtjJx5K9EJEFs=; b=AjTZ5+jRy0H0j2HxFWfUElo9uTYUaYFmkxhaYomBduvJoBuhC3tpiaO3qRTxMuBdA0 f0vgDIR8/FDuW2eBYtZElH9rTH8WA5yrqN5fS0cUNPaSN3GOEMXeV6I2ruSZ7bcJ12eK np0ly77vnUzSsInweB0Ep+U6Op52VCFNxmjlg= MIME-Version: 1.0 Received: by 10.146.121.9 with SMTP id t9mr3380771yac.17.1318237420967; Mon, 10 Oct 2011 02:03:40 -0700 (PDT) Received: by 10.147.125.13 with HTTP; Mon, 10 Oct 2011 02:03:40 -0700 (PDT) In-Reply-To: References: Date: Mon, 10 Oct 2011 11:03:40 +0200 Message-ID: To: Peter Cowburn Cc: Nikita Popov , PHP internals Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Array dereferencing using alternative array syntax From: tyra3l@gmail.com (Ferenc Kovacs) On Mon, Oct 10, 2011 at 1:30 AM, Peter Cowburn wro= te: > Hi Nikita, > > On 9 October 2011 18:14, Nikita Popov wrote: >> Hi list! >> >> PHP 5.4 added array dereferencing support (e.g. `func()[1]`), but the >> grammar seems to lack support for dereferencing using the alternative >> array access syntax (e.g. `func(){1}`). Was this done on purpose or >> was it just forgotten? > > I remember mentioning this on the list a while back, but didn't get > any further comment (it was an aside to a related thread). =C2=A0I'd like > to see the curly brace alternative added, if only to be consistent > with the existing syntax to access array/string values that can be > used elsewhere. > >> >> Some links: >> >> http://lxr.php.net/xref/PHP_TRUNK/Zend/zend_language_parser.y#array_func= tion_dereference >> http://lxr.php.net/xref/PHP_TRUNK/Zend/zend_language_parser.y#array_meth= od_dereference >> http://lxr.php.net/xref/PHP_TRUNK/Zend/zend_language_parser.y#reference_= variable >> (example of grammar with alternative syntax) >> hi, thanks for bringing this up. the alternate syntax has a rough past (if I remember correctly, [] was mentioned to be deprecated, then with 5.3 the preference was switched: [] is the preferred way now, and {} got almost deprecated), so if we plan to support the {} syntax on long term, I'm +1 for adding this to the language. I we plan to remove it eventually, then imo it is better to not introduce the support for the alternative syntax. --=20 Ferenc Kov=C3=A1cs @Tyr43l - http://tyrael.hu