Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:84473 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 83920 invoked from network); 9 Mar 2015 13:51:24 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 9 Mar 2015 13:51:24 -0000 Authentication-Results: pb1.pair.com header.from=shawn@heybigname.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=shawn@heybigname.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain heybigname.com designates 209.85.212.176 as permitted sender) X-PHP-List-Original-Sender: shawn@heybigname.com X-Host-Fingerprint: 209.85.212.176 mail-wi0-f176.google.com Received: from [209.85.212.176] ([209.85.212.176:45584] helo=mail-wi0-f176.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A0/00-18276-A55ADF45 for ; Mon, 09 Mar 2015 08:51:23 -0500 Received: by wibbs8 with SMTP id bs8so20743987wib.4 for ; Mon, 09 Mar 2015 06:51:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type; bh=SVm4umeH9dPTIDgEBH2H2tW2ZShNsNaDFL2e5bXt0No=; b=JQ+5SCYaXiKHFvph0aIJgd2bAG4URj9Y6qelDVKcEWR8p/A6TCUj04UBBDNeiC0sgI +0vGJ5mE5i6dJeNxFoPRe2zPW3zlol+o9h8vt+mknc0TlNi/IhRkO2P/VhVnPrScbbUH 3axQgGi/wTupg2I8Bv/hueMDaP93wdutzcxl1csBKNxI40KJrLRW1duwim3K3H5x0LLP vxsT6UeTVFEWAtlS6qqQXipm8ylKfajHBdqfpt1p9ss/MWqrOyLuJY/5z3LOngcmxl0Y kNHzasYuuI7NxqDx1NXen33GLRiNEwJY55IQJaMuGokqCFt3siEDIAWGrwflWNmTT7rO heWQ== X-Gm-Message-State: ALoCoQm37N1pX0X+BHsMcP7qyEPM8YExKiNGQGtcqBSlY1gO9mnwH5fis/epbYC4N9roCHRmZGzs X-Received: by 10.194.93.134 with SMTP id cu6mr57260848wjb.79.1425909078521; Mon, 09 Mar 2015 06:51:18 -0700 (PDT) MIME-Version: 1.0 Received: by 10.180.19.10 with HTTP; Mon, 9 Mar 2015 06:50:58 -0700 (PDT) X-Originating-IP: [82.217.95.45] In-Reply-To: References: Date: Mon, 9 Mar 2015 14:50:58 +0100 Message-ID: To: Mike Dugan Cc: Stelian Mocanita , reeze , "internals@lists.php.net" Content-Type: multipart/alternative; boundary=047d7bb7092c1b939d0510db54fc Subject: Re: [PHP-DEV] Request Feedback for Instance Variable Sugar RFC From: shawn@heybigname.com (Shawn McCool) --047d7bb7092c1b939d0510db54fc Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Sure, they should be separated into two equally impossible to pass RFCs. However, do you see a reasonable alternative way to achieve this type of improvement? On Mon, Mar 9, 2015 at 2:48 PM, Mike Dugan wrote: > Shawn & Stellan, > > (Apologies if this gets delivered twice, had to confirm myself on the > mailing list again) > > Agreed, @ shouldn=E2=80=99t be repurposed as a macro (or anything). That = would > lead to a huge amount of confusion for quite a while, but especially duri= ng > the early days of 7. I=E2=80=99m also not a fan of declaring the field wi= th dollar > sign prefix but using it with an @ prefix (or any other prefix for that > matter). > > These should probably be separated into two separate RFCs - > deprecating/removing @ error suppression, and pending that one being > accepted the @ instance var macro could then be sent along. > > -- > Mike Dugan > mike@dugan.io > http://dugan.io > > On March 9, 2015 at 9:32:23 AM, Stelian Mocanita (stelianm@php.net) wrote= : > > 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. > > > > > > =3D=3D=3D=3D=3D=3D PHP RFC: Instance Variable Sugar =3D=3D=3D=3D=3D= =3D > > > * Version: 0.1 > > > * Date: 2015-03-09 > > > * Author: Shawn McCool, shawn@heybigname.com > > > * Status: In Discussion > > > > > > =3D=3D=3D=3D=3D Summary =3D=3D=3D=3D=3D > > > > > > 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. > > > > > > > =3D=3D=3D=3D=3D Example =3D=3D=3D=3D=3D > > > > > > > > > > > class Addition { > > > private $number > > > > > > public function __construct($number) { > > > @number =3D $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. > > > > > > > } > > > } > > > > > > > > > =3D=3D=3D=3D=3D Backwards Compatibility =3D=3D=3D=3D=3D > > > > > > Leave `$this->` available. > > > > > > =3D=3D=3D=3D=3D Proposed PHP Version(s) =3D=3D=3D=3D=3D > > > > > > 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 > > > > --=20 Shawn McCool | Big Name shawn@heybigname.com heybigname.com --047d7bb7092c1b939d0510db54fc--