Levi, et al. > class Foo { > > private $_bar; > > public function get bar { return $this->_bar; } > > public function set bar { $this->_bar = $value; } > > } > class Foo { > private $_bar; > public get bar() { return $this->_bar; } > public set bar($value) { $this->_bar = $value; } > } > > class Foo { > private $bar; > > @bar.getter > public function getBar() { return $this->bar; } > > @bar.setter > public function setBar($value) { $this->bar = $value; } > > } >
My main issue with all of these is cognitive distance. When I want to look for a property, I look at the properties defined by a class. The currently proposed syntax, while perhaps slightly less elegant, has very low cognitive distance from the base property. I look for a property, and if I see a getter attached, I know it's there. With all three of the above, it requires me to shift from property to property or function with annotation. While this distance isn't gigantic, it is non-trivial. It requires more than a simple glance to figure out what's going on. The annotation syntax is especially bad in this regard. However, it's not a show stopper of an issue. I do like the certain elegance of the getter annotation, but I wonder what the benefits really are. It's something perhaps worth exploring (if the current trend towards rejecting the current RFC continues), but I'm not sold on it in the least... It feels a bit too disconnected from the concept of a property... Anthony