Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:48646 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 17404 invoked from network); 4 Jun 2010 07:18:20 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Jun 2010 07:18:20 -0000 Authentication-Results: pb1.pair.com header.from=mathieu.suen@easyflirt.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=mathieu.suen@easyflirt.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain easyflirt.com designates 91.199.255.56 as permitted sender) X-PHP-List-Original-Sender: mathieu.suen@easyflirt.com X-Host-Fingerprint: 91.199.255.56 python-06.easyrencontre.com Linux 2.6 Received: from [91.199.255.56] ([91.199.255.56:41780] helo=mail.easyflirt.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 34/C1-07323-AB8A80C4 for ; Fri, 04 Jun 2010 03:18:19 -0400 Received: from [192.168.0.51] (office.easyrencontre.com [78.155.152.6]) by mail.easyflirt.com (Postfix) with ESMTPSA id ACB996374CD for ; Fri, 4 Jun 2010 09:18:15 +0200 (CEST) Message-ID: <4C08A8B6.7080905@easyflirt.com> Date: Fri, 04 Jun 2010 09:18:14 +0200 User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.9) Gecko/20100423 Thunderbird/3.0.4 MIME-Version: 1.0 To: internals@lists.php.net References: In-Reply-To: Content-Type: multipart/alternative; boundary="------------000300060504050806060804" Subject: Re: [PHP-DEV] Suggestion: echo function(var)[0]; From: mathieu.suen@easyflirt.com ("mathieu.suen") --------------000300060504050806060804 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Hi Why not something more generic. Someone could think of a ValueNode. Then it could be use for object, array, any primitive type ... I will take the ValueNode as a non terminal grammar node. So first we could do that: ValueNode->method(); ValueNode::sMethod(); ValueNode[]; foo(ValueNode); echo ValueNode; $e = ValueNode; ... And a ValueNode could be define as: ValueNode : NewStatement | FunctionCall | PrimitiveValue | '(' ValueNode ')' | ...; This would allow all this syntax: (new A())->foo(); foo(new A()); foo->bar()[1]; foo()[5]; and many others. On 06/04/2010 03:19 AM, Kalle Sommer Nielsen wrote: > Hi Tig > > 2010/6/4 Tig: > >> Would be at all possible to implement this kind of shortcut? >> > Its called array-dereferencing and it was proposed countless times, > including by myself. There is an RFC for this[1] and it was planned on > the old PHP6 todo at the PDT[2]. > > [1] http://wiki.php.net/rfc/functionarraydereferencing > [2] http://wiki.php.net/summits/pdmnotesmay09#php_6 (see point #13) > > --Mathieu Suen --------------000300060504050806060804--