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 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;
  }
}
</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

Reply via email to