Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:65129 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 39607 invoked from network); 23 Jan 2013 21:33:40 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 23 Jan 2013 21:33:40 -0000 Authentication-Results: pb1.pair.com header.from=ircmaxell@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=ircmaxell@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.212.41 as permitted sender) X-PHP-List-Original-Sender: ircmaxell@gmail.com X-Host-Fingerprint: 209.85.212.41 mail-vb0-f41.google.com Received: from [209.85.212.41] ([209.85.212.41:50544] helo=mail-vb0-f41.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 24/65-30997-33750015 for ; Wed, 23 Jan 2013 16:33:39 -0500 Received: by mail-vb0-f41.google.com with SMTP id l22so4067325vbn.14 for ; Wed, 23 Jan 2013 13:33:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=WBN4OgKU2L7Pf9JoJy9j0xtjO7du6dQsslJceYZFuOE=; b=UHatjEhFyUUCD/HDFoVGryeGHzEwVOZYHsx/lCKGUautqDkTgGotZaP0js5dtdHwZI P9RhfF2fJV3BSuEMTj22ri9bxAhU45yEYEjlADSYu5/gTXgFkdakY4YLd4W95WyIWkVw AKMoEFZq34rDENm4bw0rsgIY5e3LvqNxXdMMyAY3xBMex8cptN3Yg+pdx2T+DhfQdCRH CSLZvC3YVmdZyh2/nh+WT3X6oONJWzx9OcAcMHsZ3zJOQj8j6Ry4+BE3H6CWoZVrH4TY zuT/nwRTYTGko128j/wSYsNg5T4J0QmEQdjsUCbsrlk+eSqFY0Z1hOYkrNZ7GTY6FXEe zWMw== MIME-Version: 1.0 X-Received: by 10.52.31.197 with SMTP id c5mr2719719vdi.65.1358976816374; Wed, 23 Jan 2013 13:33:36 -0800 (PST) Received: by 10.58.173.4 with HTTP; Wed, 23 Jan 2013 13:33:36 -0800 (PST) In-Reply-To: References: <510038C9.5000900@mrclay.org> Date: Wed, 23 Jan 2013 16:33:36 -0500 Message-ID: To: Levi Morrison Cc: Clint Priest , Steve Clay , PHP Internals Content-Type: multipart/alternative; boundary=bcaec517c54865e4e404d3fb721e Subject: Re: [PHP-DEV] C# properties vs. accessors RFC From: ircmaxell@gmail.com (Anthony Ferrara) --bcaec517c54865e4e404d3fb721e Content-Type: text/plain; charset=ISO-8859-1 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 --bcaec517c54865e4e404d3fb721e--