Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:48691 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 63270 invoked from network); 8 Jun 2010 15:21:15 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 8 Jun 2010 15:21:15 -0000 Authentication-Results: pb1.pair.com header.from=peter.e.lind@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=peter.e.lind@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.214.170 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: peter.e.lind@gmail.com X-Host-Fingerprint: 209.85.214.170 mail-iw0-f170.google.com Received: from [209.85.214.170] ([209.85.214.170:58970] helo=mail-iw0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id FA/80-13782-BEF5E0C4 for ; Tue, 08 Jun 2010 11:21:15 -0400 Received: by iwn8 with SMTP id 8so2275581iwn.29 for ; Tue, 08 Jun 2010 08:21:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=tbmCEvDDAf8MlYLNeqPc0vFyfPiTHgpXG3dwFe6LlIo=; b=cz+WFnMGS2nK+R3R5+NaXvrDzbhto4VKfHXysBJ46PAZE3KILYsK5zKcEtzcMvAGLz Ewv5bs0oWXJXRq0BQak4yzXdURMSXNx0R1xWL/xdLwiyObZ4JIq9Bg3NHlHkKTLxBq6Z iLx2AQyNcG06AFph5J5cYz0x/kuO9yj+ESI4o= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; b=i7AszvVZzOiFeFuQBqjDHMGzrj8nopK+Ayo/jbOIy8z7yMQ5sBuXnIZk+kCRLd0d0q zbuF2BBNlEMjMOHXF72zKfGdh4wdUCJ5ja/d3chfrEkx8kAlVLEDFREjqSbHq5qupqrt jezIj6NFM5i5lrlVlyBFIJL76C5yQu9ea/hdk= Received: by 10.231.124.17 with SMTP id s17mr6309281ibr.181.1276010472949; Tue, 08 Jun 2010 08:21:12 -0700 (PDT) MIME-Version: 1.0 Received: by 10.231.37.70 with HTTP; Tue, 8 Jun 2010 08:20:52 -0700 (PDT) In-Reply-To: <93ED589E60BA254F97435FE6C97F2C670A96E32C@leedsmet-exch1.leedsmet.ac.uk> References: <2C70277E-0442-49B8-AD0B-E9F12ED7B42C@oettinger.dk> <1275993681.2243.10.camel@guybrush> <93ED589E60BA254F97435FE6C97F2C670A96E32C@leedsmet-exch1.leedsmet.ac.uk> Date: Tue, 8 Jun 2010 17:20:52 +0200 Message-ID: To: "Ford, Mike" Cc: internals Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] [RFC] Array Dereferencing From: peter.e.lind@gmail.com (Peter Lind) On 8 June 2010 16:57, Ford, Mike wrote: >> -----Original Message----- >> From: Jacob Oettinger [mailto:jacob@oettinger.dk] >> Sent: 08 June 2010 14:09 >> >> On 08/06/2010, at 12.41, Johannes Schl=C3=BCter wrote: >> >> > On Tue, 2010-06-08 at 12:23 +0200, Jacob Oettinger wrote: >> >> Would it be equally simple to allow the syntax below? >> >> >> >> $result =3D new ResultMaker()->getIt(); >> > >> > does this mean >> > >> > =C2=A0 =C2=A0$result =3D new (ResultMaker()->getIt()); >> > >> > or >> > >> > =C2=A0 =C2=A0$result =3D (new ResultMaker())->getIt(); >> > >> > I assume the later, but that is non-obvious as we allow >> > >> > =C2=A0 =C2=A0$result =3D new $class(); >> >> Yes the later. I do not see how the above makes it non-obvious. > > I think the only problem with deciding which it means is that -> and () a= re not defined as operators in the PHP documentation, and as such do not ha= ve a clearly-defined precedence and associativity. In Javascript, "." (prop= erty access) and "()" (function call) both appear in the operator precedenc= e table, so there are definite rules for ascertaining the meaning of such a= construct. > > Up until recently this probably hasn't really been a problem, as it's not= been possible to write constructs that needed these rules to decipher them= . However, with the previous addition of object access chaining, and now ar= ray dereferencing, the time has almost certainly come to add -> and () to t= he operator documentation, with appropriate precedence and associativity. > > (Incidentally, other operators which are not documented in the "Operators= " section, and probably should be, include :: (which *is* described in the = "Classes and Objects" section as the "Scope Resolution Operator", and \ (na= mespace separator).) > The operator that really determines this is 'new' - which is already documented. So there isn't any ambiguity. Not to say that documenting the other operators would be bad, just saying there's no ambiguity here :) Also, allowing "new (blah());" would be a fairly big BC break I'd say. Regards Peter --=20 WWW: http://plphp.dk / http://plind.dk LinkedIn: http://www.linkedin.com/in/plind BeWelcome/Couchsurfing: Fake51 Twitter: http://twitter.com/kafe15