There's a cultural disposition against re-purposing a symbol from one major version to the next. Let's consider that as fact and move on.
If I wanted to provide syntactic sugar to replace a symbol with $this-> so that our code can become more expressive if we choose to use it, how would you recommend implementing that? @ is not going to be a _real_ option. But what about.. :number = $number; :add(:number, $number); or some other character? On Mon, Mar 9, 2015 at 2:56 PM, Mike Dugan <m...@dugan.io> wrote: > Sure, they should be separated into two equally impossible to pass RFCs. > > Just a suggestion based on what I’ve seen here before :) > > However, do you see a reasonable alternative way to achieve this type of > improvement? > > > I’m not sure if you mean the syntax in general or more specifically the > declare-with-$ / use-with-@ issue I took with it? > > -- > Mike Dugan > m...@dugan.io > http://dugan.io > > On March 9, 2015 at 9:51:20 AM, Shawn McCool (sh...@heybigname.com) wrote: > > 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 <m...@dugan.io> wrote: > >> Shawn & Stellan, >> >> (Apologies if this gets delivered twice, had to confirm myself on the >> mailing list again) >> >> Agreed, @ shouldn’t be repurposed as a macro (or anything). That would >> lead to a huge amount of confusion for quite a while, but especially during >> the early days of 7. I’m also not a fan of declaring the field with 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 >> m...@dugan.io >> http://dugan.io >> >> On March 9, 2015 at 9:32:23 AM, Stelian Mocanita (steli...@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 <re...@php.net> wrote: >> >> > Hi, >> > >> > On 9 March 2015 at 17:43, Shawn McCool <sh...@heybigname.com> 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, sh...@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 ===== >> > > >> > > <file php MyClass.php> >> > > <?php >> > > 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. >> > >> > >> > > } >> > > } >> > > </file> >> > > >> > > ===== Backwards Compatibility ===== >> > > >> > > Leave `$this->` available. >> > > >> > > ===== Proposed PHP Version(s) ===== >> > > >> > > This is proposed for the next PHP x, currently PHP 7. >> > > >> > > -- >> > > Shawn McCool | Big Name >> > > sh...@heybigname.com >> > > heybigname.com >> > > >> > >> > >> > >> > -- >> > Reeze Xia >> > http://reeze.cn >> > >> >> > > > -- > Shawn McCool | Big Name > sh...@heybigname.com > heybigname.com > > -- Shawn McCool | Big Name sh...@heybigname.com heybigname.com