Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:48690 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 55096 invoked from network); 8 Jun 2010 14:57:34 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 8 Jun 2010 14:57:34 -0000 Authentication-Results: pb1.pair.com smtp.mail=M.Ford@leedsmet.ac.uk; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=M.Ford@leedsmet.ac.uk; sender-id=pass Received-SPF: pass (pb1.pair.com: domain leedsmet.ac.uk designates 207.126.144.131 as permitted sender) X-PHP-List-Original-Sender: M.Ford@leedsmet.ac.uk X-Host-Fingerprint: 207.126.144.131 eu1sys200aog111.obsmtp.com Linux 2.5 (sometimes 2.4) (4) Received: from [207.126.144.131] ([207.126.144.131:35151] helo=eu1sys200aog111.obsmtp.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 89/EE-13782-B5A5E0C4 for ; Tue, 08 Jun 2010 10:57:33 -0400 Received: from source ([160.9.192.20]) by eu1sys200aob111.postini.com ([207.126.147.11]) with SMTP ID DSNKTA5aWPtnisq24VLWVrSJWZhUKGVEFLH2@postini.com; Tue, 08 Jun 2010 14:57:32 UTC Received: from leedsmet-exch1.leedsmet.ac.uk ([160.9.35.117]) by mrelay-c.lmu.ac.uk with esmtp (Exim 4.60) (envelope-from ) id 1OM0F5-0001np-LH for internals@lists.php.net; Tue, 08 Jun 2010 15:57:27 +0100 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Date: Tue, 8 Jun 2010 15:57:25 +0100 Message-ID: <93ED589E60BA254F97435FE6C97F2C670A96E32C@leedsmet-exch1.leedsmet.ac.uk> In-Reply-To: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PHP-DEV] [RFC] Array Dereferencing Thread-Index: AcsHDDjUvRs9OfULTpOFMzrFvqSP+AAC5X8Q References: <2C70277E-0442-49B8-AD0B-E9F12ED7B42C@oettinger.dk> <1275993681.2243.10.camel@guybrush> To: "internals" Subject: RE: [PHP-DEV] [RFC] Array Dereferencing From: M.Ford@leedsmet.ac.uk ("Ford, Mike") > -----Original Message----- > From: Jacob Oettinger [mailto:jacob@oettinger.dk] > Sent: 08 June 2010 14:09 >=20 > On 08/06/2010, at 12.41, Johannes Schl=FCter wrote: >=20 > > 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 > > > > $result =3D new (ResultMaker()->getIt()); > > > > or > > > > $result =3D (new ResultMaker())->getIt(); > > > > I assume the later, but that is non-obvious as we allow > > > > $result =3D new $class(); >=20 > 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 () are= not defined as operators in the PHP documentation, and as such do not have= a clearly-defined precedence and associativity. In Javascript, "." (proper= ty access) and "()" (function call) both appear in the operator precedence = table, so there are definite rules for ascertaining the meaning of such a c= onstruct. Up until recently this probably hasn't really been a problem, as it's not b= een possible to write constructs that needed these rules to decipher them. = However, with the previous addition of object access chaining, and now arra= y dereferencing, the time has almost certainly come to add -> and () to the= 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 "C= lasses and Objects" section as the "Scope Resolution Operator", and \ (name= space separator).) Cheers! Mike --=20 Mike Ford, Electronic Information Developer, Libraries and Learning Innovation,=20=20 Leeds Metropolitan University, C507, Civic Quarter Campus,=20 Woodhouse Lane, LEEDS,=A0 LS1 3HE,=A0 United Kingdom=20 Email: m.ford@leedsmet.ac.uk=20 Tel: +44 113 812 4730 To view the terms under which this email is distributed, please go to http:= //disclaimer.leedsmet.ac.uk/email.htm