On 9 March 2015 09:43:32 GMT, Shawn McCool <sh...@heybigname.com> wrote:

>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.

I disagree with this premise. The $this here is not just decorative syntax, 
it's an actual variable, which can be passed around just like any other 
variable. The -> is then the standard way of accessing a property or method, 
applied to that variable.

This is beautifully simple, and expresses what's going on perfectly: if you 
look at $this->foo, and ask "which foo is being referenced here?", the answer 
is clearly "the one which is a property of $this".

The only places I can see value in a shorthand are in constructors and setters, 
where you're just copying from one name to another ($this->foo = $foo). But the 
part that's redundant there is the variable/property names, not the $this, so 
what you need is getter/setter support, or shorthand constructors (you should 
be able to find previous RFCs for both).

Regards, 
-- 
Rowan Collins
[IMSoP]


-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to