Re: Request Feedback for Instance Variable Sugar RFC

From: Date: Mon, 09 Mar 2015 22:02:00 +0000
Subject: Re: Request Feedback for Instance Variable Sugar RFC
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-84488@lists.php.net to get a copy of this message
Hi! >> 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. Completely agree. The problem with going to far with overly "expressive" code - i.e. one that uses as little characters as possible - is that it becomes less and less comprehensible. $this-> is not too long to be any real problem (and if it's really that troublesome one always can code a macro in their editor). It is abundantly clear to both novice and seasoned programmer. It is a subclass of wider standard syntax (-> as member access). It has shared pattern for properties and methods, so you don't need to keep too many concepts in your mind to parse it. I don't think saving half-dozen characters is worth sacrificing all that. -- Stas Malyshev smalyshev@gmail.com

« previous php.internals (#84488) next »