Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:84496 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 56502 invoked from network); 10 Mar 2015 03:24:59 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 10 Mar 2015 03:24:59 -0000 Authentication-Results: pb1.pair.com smtp.mail=larry@garfieldtech.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=larry@garfieldtech.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain garfieldtech.com from 66.111.4.26 cause and error) X-PHP-List-Original-Sender: larry@garfieldtech.com X-Host-Fingerprint: 66.111.4.26 out2-smtp.messagingengine.com Received: from [66.111.4.26] ([66.111.4.26:43791] helo=out2-smtp.messagingengine.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 9A/D0-51288-B046EF45 for ; Mon, 09 Mar 2015 22:24:59 -0500 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id DCF46210A7 for ; Mon, 9 Mar 2015 23:24:54 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute3.internal (MEProxy); Mon, 09 Mar 2015 23:24:56 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=x-sasl-enc:message-id:date:from :mime-version:to:subject:references:in-reply-to:content-type :content-transfer-encoding; s=smtpout; bh=fp192uAG3rP99t7JDE+E4H Myn2M=; b=hqweBW1n3w3mhzrS5/080bPyTMjV6kf8ozA0eOkCy/kLwKURQBzvux zOE39iC6OYYExa+Aqjl2cnshau7bKc+wY1rL2TShKLscO/pRyvWzaCdCkFQoPMhA hJCs5Oy8Zarm5qPl7cvNyBMtC1tbBQtBQfUKHlvWPsMSbun6B6fY8= X-Sasl-enc: W2DXEp0KiQzofBIU1e507KTzE+4nY0WTGeiHDwDBsy9Y 1425957895 Received: from [192.168.42.140] (unknown [98.226.241.18]) by mail.messagingengine.com (Postfix) with ESMTPA id D49C36800F1 for ; Mon, 9 Mar 2015 23:24:55 -0400 (EDT) Message-ID: <54FE6406.6050209@garfieldtech.com> Date: Mon, 09 Mar 2015 22:24:54 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: internals@lists.php.net References: In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Request Feedback for Instance Variable Sugar RFC From: larry@garfieldtech.com (Larry Garfield) On 03/09/2015 04:26 PM, Rowan Collins wrote: > On 9 March 2015 09:43:32 GMT, Shawn McCool wrote: > >> In order to access instance variables, one must use the `$this->` >> prefix. >> The problem with this is that it reduces expressiveness in the language >> and >> increases the amount of unnecessary decoration, reducing readability. > I disagree with this premise. The $this here is not just decorative syntax, it's an actual variable, which can be passed around just like any other variable. The -> is then the standard way of accessing a property or method, applied to that variable. > > This is beautifully simple, and expresses what's going on perfectly: if you look at $this->foo, and ask "which foo is being referenced here?", the answer is clearly "the one which is a property of $this". > > The only places I can see value in a shorthand are in constructors and setters, where you're just copying from one name to another ($this->foo = $foo). But the part that's redundant there is the variable/property names, not the $this, so what you need is getter/setter support, or shorthand constructors (you should be able to find previous RFCs for both). > > Regards, I concur. I don't see much advantage of a short hand in this case, but I would love to see someone pick up both the property RFC (which implied short-hand getter/setters) and shorthand constructors. (It's undoubtedly too late for 7.0, but they'd be great additions for 7.1.) --Larry Garfield