Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:84462 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 47651 invoked from network); 9 Mar 2015 10:54:41 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 9 Mar 2015 10:54:41 -0000 Authentication-Results: pb1.pair.com header.from=reeze.xia@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=reeze.xia@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.212.176 as permitted sender) X-PHP-List-Original-Sender: reeze.xia@gmail.com X-Host-Fingerprint: 209.85.212.176 mail-wi0-f176.google.com Received: from [209.85.212.176] ([209.85.212.176:40403] helo=mail-wi0-f176.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 7B/5A-29848-0FB7DF45 for ; Mon, 09 Mar 2015 05:54:41 -0500 Received: by wivr20 with SMTP id r20so18998398wiv.5 for ; Mon, 09 Mar 2015 03:54:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=QUU2dtNHxuThMbkcu1zw7ru11sqfy/+9PA3jWtD46Kc=; b=Hcz/AST/cBbXmM6EIsdsM6Ess2V5b8eNjXwtFHACxjiS3eEKZ36K2fqrG8RSV0Z91o lNkb3tCUqtcJKWY0ByAs0YLatFXJ6VFVuBI61CKWA5UIhdKbq79r+PKmJq8we/iuwegH XMWTW9ziM9UEkhLSzx4xYtGQl5UgWWsUUBvVGieaXhwOGRql4FLgd6VMW/vWFzzc9Y3b 8LSwYzi5OGrApHePC5ScSJ5SA0bTQMdzlFKQQXqrfw6Y7X2ofMG6iinXeDgzWZ5OufJA RyOkC5Usq+bR8QAg5asDpKGoBEv78UIHXRC1r/dndLjwjYAFczmdV1zmc/Mow20YmZg9 Z78Q== X-Received: by 10.194.184.83 with SMTP id es19mr55843867wjc.93.1425898477722; Mon, 09 Mar 2015 03:54:37 -0700 (PDT) MIME-Version: 1.0 Sender: reeze.xia@gmail.com Received: by 10.194.58.241 with HTTP; Mon, 9 Mar 2015 03:54:17 -0700 (PDT) In-Reply-To: References: Date: Mon, 9 Mar 2015 18:54:17 +0800 X-Google-Sender-Auth: VQjqJpo6eERb56QAZ3ov98157HQ Message-ID: To: Shawn McCool Cc: "internals@lists.php.net" Content-Type: multipart/alternative; boundary=047d7ba97c2a4041b40510d8dca4 Subject: Re: [PHP-DEV] Request Feedback for Instance Variable Sugar RFC From: reeze@php.net (reeze) --047d7ba97c2a4041b40510d8dca4 Content-Type: text/plain; charset=ISO-8859-1 Hi, On 9 March 2015 at 17:43, Shawn McCool wrote: > I've never submitted an RFC. Whether or not you're interested in the > feature, please consider giving me feedback on the RFC itself so that I can > better understand how to succeed in the process. > > ====== PHP RFC: Instance Variable Sugar ====== > * Version: 0.1 > * Date: 2015-03-09 > * Author: Shawn McCool, shawn@heybigname.com > * Status: In Discussion > > ===== Summary ===== > > 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. > This might decrease readability, since we already comfortable with the syntax $this->something, in my opinion > This RFC proposes a single character syntax sugar form of `$this->`. > Instead, an `@` can be used to reference instance variables. > > The @ replaces the normal $ variable prefix. > ===== Example ===== > > > class Addition { > private $number > > public function __construct($number) { > @number = $number; > } > > public function original() { > return @number; > } > > public function addTo($amount) { > return @number + $amount; > this is a BC break. this is the same as constant number + $amount. so this syntax is not feasible. > } > } > > > ===== Backwards Compatibility ===== > > Leave `$this->` available. > > ===== Proposed PHP Version(s) ===== > > This is proposed for the next PHP x, currently PHP 7. > > -- > Shawn McCool | Big Name > shawn@heybigname.com > heybigname.com > -- Reeze Xia http://reeze.cn --047d7ba97c2a4041b40510d8dca4--