Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:48647 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 24427 invoked from network); 4 Jun 2010 08:00:47 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Jun 2010 08:00:47 -0000 Authentication-Results: pb1.pair.com header.from=rquadling@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=rquadling@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.211.176 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: rquadling@gmail.com X-Host-Fingerprint: 209.85.211.176 mail-yw0-f176.google.com Received: from [209.85.211.176] ([209.85.211.176:60010] helo=mail-yw0-f176.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 51/33-07323-DA2B80C4 for ; Fri, 04 Jun 2010 04:00:46 -0400 Received: by ywh6 with SMTP id 6so911959ywh.16 for ; Fri, 04 Jun 2010 01:00:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:reply-to :in-reply-to:references:from:date:message-id:subject:to:cc :content-type:content-transfer-encoding; bh=DFht3aPWqJrOuuYDVO1nbm+kqnor7VQLeWQscurZlOg=; b=foCJCgCVyYsD4+qsRpaPr8GPz2F3KAKGsLQfQLGTf/bNJB6EbGsk76gMwbugsZc1sz 1vLqjl3yZB8pmjM+VFoWlTugYcpyJoRRlcleEt1M9HT34oNSuEpX3YITeELAp+9a71vu UVp5X5KMIcjq5Tue1gxWjQBO+FZgb/fa6JRr0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:reply-to:in-reply-to:references:from:date:message-id :subject:to:cc:content-type:content-transfer-encoding; b=lvOaULUDwlCVvqi+6FB94m/eJ0sPYga7cHeNMvotvRwx8OJ9QIpPaNFTmUAlVBsAmq 0f7qySVXGOgHKWpXC6IYf1NjjiwIrpUDc/qlEwSvsUlF1MbLS4kr7ZYvIt2fj5TS7/cK 2gBIwDYOhFJQ9ZP3qCdZWigXqw0NPX+vWQEy4= Received: by 10.101.131.14 with SMTP id i14mr11734420ann.63.1275638442440; Fri, 04 Jun 2010 01:00:42 -0700 (PDT) MIME-Version: 1.0 Received: by 10.100.12.20 with HTTP; Fri, 4 Jun 2010 01:00:22 -0700 (PDT) Reply-To: RQuadling@googlemail.com In-Reply-To: <4C08A8B6.7080905@easyflirt.com> References: <4C08A8B6.7080905@easyflirt.com> Date: Fri, 4 Jun 2010 09:00:22 +0100 Message-ID: To: "mathieu.suen" Cc: internals@lists.php.net Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Suggestion: echo function(var)[0]; From: rquadling@gmail.com (Richard Quadling) On 4 June 2010 08:18, mathieu.suen wrote: > 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 =3D ValueNode; > ... > > And a ValueNode could be define as: > > ValueNode : > > =C2=A0 =C2=A0 =C2=A0NewStatement > =C2=A0 =C2=A0| FunctionCall > =C2=A0 =C2=A0| PrimitiveValue > =C2=A0 =C2=A0| '(' ValueNode ')' > =C2=A0 =C2=A0| ...; > > 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 > > > > Not an expert in this area, but does this mechanism limit you to using single dimensional arrays? --=20 ----- Richard Quadling "Standing on the shoulders of some very clever giants!" EE : http://www.experts-exchange.com/M_248814.html EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp Zend Certified Engineer : http://zend.com/zce.php?c=3DZEND002498&r=3D213474= 731 ZOPA : http://uk.zopa.com/member/RQuadling