Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:63732 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 73321 invoked from network); 31 Oct 2012 20:25:11 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 31 Oct 2012 20:25:11 -0000 Authentication-Results: pb1.pair.com smtp.mail=lars@strojny.net; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=lars@strojny.net; sender-id=unknown Received-SPF: error (pb1.pair.com: domain strojny.net from 46.4.40.248 cause and error) X-PHP-List-Original-Sender: lars@strojny.net X-Host-Fingerprint: 46.4.40.248 milch.schokokeks.org Received: from [46.4.40.248] ([46.4.40.248:58882] helo=milch.schokokeks.org) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A5/48-24645-52981905 for ; Wed, 31 Oct 2012 15:25:10 -0500 Received: from [192.168.1.121] (p5099f5c8.dip0.t-ipconnect.de [::ffff:80.153.245.200]) (AUTH: PLAIN lars@schokokeks.org, TLS: TLSv1/SSLv3,128bits,AES128-SHA) by milch.schokokeks.org with ESMTPSA; Wed, 31 Oct 2012 21:25:06 +0100 id 0000000000000026.0000000050918922.0000220F Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Mac OS X Mail 6.2 \(1499\)) In-Reply-To: <50918018.4010501@sugarcrm.com> Date: Wed, 31 Oct 2012 21:25:04 +0100 Cc: Etienne Kneuss , Nikita Popov , Clint Priest , PHP Developers Mailing List Content-Transfer-Encoding: quoted-printable Message-ID: <515BB3BA-CDA2-411E-9738-7A6FB983FAD5@strojny.net> 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> <50905FBD.1080208@sugarcrm.com> <50918018.4010501@sugarcrm.com> To: Stas Malyshev X-Mailer: Apple Mail (2.1499) Subject: Re: [PHP-DEV] [RFC] Property Accessors v1.2 : Internal Accessor Method Visibility / Callability From: lars@strojny.net (Lars Strojny) Hi Stas, hi Etienne, let=92s get practical and apply LSP to property accessors. Find below = what I would read from the characteristics of LSP. Am 31.10.2012 um 20:46 schrieb Stas Malyshev : [...] >> Instead, LSP simply states that, given B <: A, all objects of A can = be >> substituted by objects of B while preserving the validity of the >> method calls on these objects, and the validity of their return >> values. This is guaranteed here: Characteristics 1: Contravariance of method arguments in subtypes This applies to properties in so forth, that weaker requirements need to = be allowed. This means: - Redeclaring a property without a specific type is OK (e.g. parent = DateTime, children everything) - Redeclaring a property with a supertype is OK (e.g. parent = MyDateTime, children DateTime) - Redeclaring a property that was read only as read-writable is OK in = theory (it isn=92t because of the history rule) - Redeclaring a property with as less visible is not OK (parent = public, children protected) - Redeclaring a property with as more visible is OK (parent protected, = children public) - Redeclaring a property as read-only is not OK (parent rw, children = ro) Characteristics 2: Covariance of method return values in subtypes - For properties, this basically mirrors the rules from rules from = characteristics 1 Characteristics 3: Preconditions cannot be strengthened: This is = something we cannot and should not prevent in the language itself but = it=92s up to the programmer to do this correctly Characteristics 4: Postconditions cannot be weakened: See 3 Characterestics 5: History rule. See 3 cu, Lars=