Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:84471 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 77261 invoked from network); 9 Mar 2015 13:31:46 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 9 Mar 2015 13:31:46 -0000 Authentication-Results: pb1.pair.com header.from=stelian.mocanita@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=stelian.mocanita@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.215.54 as permitted sender) X-PHP-List-Original-Sender: stelian.mocanita@gmail.com X-Host-Fingerprint: 209.85.215.54 mail-la0-f54.google.com Received: from [209.85.215.54] ([209.85.215.54:38538] helo=mail-la0-f54.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F6/00-29848-FB0ADF45 for ; Mon, 09 Mar 2015 08:31:44 -0500 Received: by labgf13 with SMTP id gf13so46340386lab.5 for ; Mon, 09 Mar 2015 06:31:40 -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:date:message-id:subject :from:to:cc:content-type; bh=cK5PGNMEN7F/UjhcH6jRlOKfF9RzVR9kARHp/vToO3k=; b=wPhfFWKajDIvBdzru9x+x2NtrjGufWpyMLNpAJeubgMj6Eg1bNYKPTvTLBxk5iDEhb oALPx0qqBbpyYLT7hH6bpGbufKWtyolADARK8/tCUSQnDsxAcGKMAK+lXc9/uk60QZC9 9b2tjsZtVqoF3fmly340hE80TlKc+t+QBoTPfmPdjYWBAV2/N7ye6gs0olsBljVvcNLE yUoahbQWlQlG867V+TJ28OasG1vMni/03EgLjGl2OvciyFxqga6xsqDp80XdeVSkrT/0 Ox3NEsftG4BBYNQW0/zSkVOlc7jJfgKK6EB/tXONTzPTb4iKwj9VU6x0ddBz0sxiilK8 9XHQ== MIME-Version: 1.0 X-Received: by 10.152.243.4 with SMTP id wu4mr25858389lac.33.1425907900497; Mon, 09 Mar 2015 06:31:40 -0700 (PDT) Sender: stelian.mocanita@gmail.com Received: by 10.112.217.11 with HTTP; Mon, 9 Mar 2015 06:31:40 -0700 (PDT) In-Reply-To: References: Date: Mon, 9 Mar 2015 14:31:40 +0100 X-Google-Sender-Auth: WSzXIMOEWIJUff-wQmUk_UpSo_w Message-ID: To: reeze Cc: Shawn McCool , "internals@lists.php.net" Content-Type: multipart/alternative; boundary=001a1134282ce445f90510db0df4 Subject: Re: [PHP-DEV] Request Feedback for Instance Variable Sugar RFC From: stelianm@php.net (Stelian Mocanita) --001a1134282ce445f90510db0df4 Content-Type: text/plain; charset=UTF-8 Hi Shawn, My opinion is that even though the "@" operator should be deprecated in further along the line removed, it should not be repurposed for anything, it has too much legacy imho. While a shortcut might be a good idea, I personally favour the $this->var syntax just for muscle memory if nothing else. Stelian On Mon, Mar 9, 2015 at 11:54 AM, reeze wrote: > 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 > --001a1134282ce445f90510db0df4--