Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:63727 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 60303 invoked from network); 30 Oct 2012 23:16:18 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 30 Oct 2012 23:16:18 -0000 Authentication-Results: pb1.pair.com smtp.mail=smalyshev@sugarcrm.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=smalyshev@sugarcrm.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain sugarcrm.com designates 67.192.241.203 as permitted sender) X-PHP-List-Original-Sender: smalyshev@sugarcrm.com X-Host-Fingerprint: 67.192.241.203 smtp203.dfw.emailsrvr.com Linux 2.6 Received: from [67.192.241.203] ([67.192.241.203:56632] helo=smtp203.dfw.emailsrvr.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 5C/80-56709-1CF50905 for ; Tue, 30 Oct 2012 18:16:17 -0500 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp20.relay.dfw1a.emailsrvr.com (SMTP Server) with ESMTP id EABA3259DE4; Tue, 30 Oct 2012 19:16:14 -0400 (EDT) X-Virus-Scanned: OK Received: by smtp20.relay.dfw1a.emailsrvr.com (Authenticated sender: smalyshev-AT-sugarcrm.com) with ESMTPSA id 7EBA5258178; Tue, 30 Oct 2012 19:16:13 -0400 (EDT) Message-ID: <50905FBD.1080208@sugarcrm.com> Date: Tue, 30 Oct 2012 16:16:13 -0700 Organization: SugarCRM User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:16.0) Gecko/20121010 Thunderbird/16.0.1 MIME-Version: 1.0 To: Etienne Kneuss CC: Nikita Popov , Clint Priest , PHP Developers Mailing List References: <508A67E6.2000405@zerocue.com> <508A9AC9.50200@sugarcrm.com> <508AF3E7.7020004@sugarcrm.com> <508B1EA2.8060203@sugarcrm.com> <508C249D.1000309@zerocue.com> <508C43ED.9000209@sugarcrm.com> <508C80C6.9000008@zerocue.com> <508CD916.1070509@sugarcrm.com> <508D5462.4070503@zerocue.com> <508EFB76.4080604@sugarcrm.com> <50904C0C.8030207@sugarcrm.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [RFC] Property Accessors v1.2 : Internal Accessor Method Visibility / Callability From: smalyshev@sugarcrm.com (Stas Malyshev) Hi! >> I'm not sure why you are expecting this, and also this is probably an >> LSP violation, since such override would change semantics of the value >> that A clients expect. It may be possible to implement, technically, but >> I'm not sure it's the right thing to do. > > Why would it be not expected and/or a violation of LSP? Accessors > impose stricly more restrictions than properties. This code is fine. You assume accessors are restrictions, but they don't have to be. Consider: public $foo { get() { return $this->foo;} set($v) { $this->foo_copy = $this->foo = $v; } } You have a postcondition on set() that $this->foo_copy will be the same as $this->foo. Override with "public $foo" removes that postcondition. But proper inheritance should only strengthen the postconditions, not drop them. > Just like it is fine in theory to have interface A { public $foo { > get(); set($v); } } class B implements A { public $foo; } That's different. In this case, you say "I will have some property $foo", without promising anything about it. But specific code can actually make some promises about $foo, and you can violate these promises by overriding it with public $foo. Interface does not impose any conditions except that $foo exist and is gettable/settable. Specific getters/setters can impose much more involved conditions, which "public $foo" may not be able to satisfy. -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/ (408)454-6900 ext. 227