Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:37383 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 31275 invoked from network); 30 Apr 2008 19:14:10 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 30 Apr 2008 19:14:10 -0000 Authentication-Results: pb1.pair.com smtp.mail=lars@strojny.net; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=lars@strojny.net; sender-id=pass Received-SPF: pass (pb1.pair.com: domain strojny.net designates 78.46.69.2 as permitted sender) X-PHP-List-Original-Sender: lars@strojny.net X-Host-Fingerprint: 78.46.69.2 milch.schokokeks.org Received: from [78.46.69.2] ([78.46.69.2:40530] helo=milch.schokokeks.org) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 09/A2-13507-005C8184 for ; Wed, 30 Apr 2008 15:14:10 -0400 Received: from [192.168.0.100] (xdsl-87-78-213-244.netcologne.de [::ffff:87.78.213.244]) (AUTH: PLAIN lars@schokokeks.org, SSL: TLSv1/SSLv3,256bits,CAMELLIA256-SHA) by milch.schokokeks.org with esmtp; Wed, 30 Apr 2008 21:14:05 +0200 id 000000000000C00E.000000004818C4FD.00002BED To: Stanislav Malyshev Cc: internals@lists.php.net In-Reply-To: <4818A615.9010905@zend.com> References: <48169695.9040803@omegavortex.net> <339714303.20080429114607@marcus-boerger.de> <4817596B.8020109@zend.com> <1209494001.31298.17.camel@localhost> <4818A615.9010905@zend.com> Date: Wed, 30 Apr 2008 21:14:04 +0200 Message-ID: <1209582844.3784.20.camel@localhost> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=_milch.schokokeks.org-11245-1209582845-0001-2" X-Mailer: Evolution 2.22.0 Subject: Re: [PHP-DEV] Class Properties in Interfaces? From: lars@strojny.net (Lars Strojny) --=_milch.schokokeks.org-11245-1209582845-0001-2 Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Good evening Stas, Am Mittwoch, den 30.04.2008, 10:02 -0700 schrieb Stanislav Malyshev: [...] > You can easily do this by having __get call getProperty. That's like 1=20 > line of code to do. No language change needed. With the substantial difference, that __get()/__set() does not work properly with inheritance, as the language can't verify the LSP. class Mother { public function __set($property, $value) { switch ($property) { case 'foo': $this->_foo =3D (string)$value; return true; } } } class Child extends Mother { public function __set($property, $value) { switch ($property) { case 'foo': throw new Exception('Foo is not allowed to set'); } return parent::__set($property, $value); } } This means, Child behaves more strict than Mother and breaks the principle. With advanced properties, the interpreter could at least verify that getting/setting properties is not stricter in subclasses. SO far, Lars --=_milch.schokokeks.org-11245-1209582845-0001-2 Content-Type: application/pgp-signature; name="signature.asc" Content-Transfer-Encoding: 7bit Content-Description: Dies ist ein digital signierter Nachrichtenteil -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.8 (GNU/Linux) iQIcBAABAgAGBQJIGMT8AAoJECQPF+sCY6wH3wsQAJ5ugjlXY2As8tEa23vZiCpC CWOOWu24FegzBBVt3ACZIVp0wtRJcs3pGTmq2JUZiuhwysxQ+PcYmW+mpKXZxHmB /fPsk2EHK7bbif0hkAFp2uowMv6rXK5PYF4X3au0TczYITBpWojRYPzt4nyedCE0 oYXrlLbrBRnwqbZ7FUzJkxHJbHukjCAISuqkEj5uov+GnWrVwdAyUCa4U4vJqvKX RkB3jGzHrhLmFtMD9AvaOzWMX0BXQIH6+XBDREGwzNvXlQ5m+ySoWs1ssaTaYEwg 8wh4GQ9pVz+VE9vqedi3zrOrmPDSv4/A/KJNjyuDENBPq9Tn+KXqxM/PB3/2JkCi B/98qOA+OVkmky6gWc1717VQSoZDqWCqkMn8Jn7ctffWw7QiGhufVo3VmZMAzmPg nUUpIU6nBAtm+YH4P5pZIo7dxPv2/XsHjBuI/PodHC4NiU5fPzIM5rFuGRlGESeK K4RBbi2afozam5ij7XMDyWNiqWWNRAm81UGMqU73tVRGjPVgTAvO6LBwiyD4sVjl 4keGhW5SXpu2ydwMbkY6mC8q5DFnwdsrjvw2/Z0wUA1C8CbnmTTGblyGrUDfXV6R j3Ace5TcPMRxmdaAj6axL72sE6QcLHvvt4Byf6rOt1fs74owDTwOXdQKAeagLc0W ve+CCBVcVo7Z68wSGulU =r41U -----END PGP SIGNATURE----- --=_milch.schokokeks.org-11245-1209582845-0001-2--