Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:63475 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 44388 invoked from network); 16 Oct 2012 21:52:34 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Oct 2012 21:52:34 -0000 Authentication-Results: pb1.pair.com smtp.mail=cpriest@zerocue.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=cpriest@zerocue.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zerocue.com designates 74.115.204.51 as permitted sender) X-PHP-List-Original-Sender: cpriest@zerocue.com X-Host-Fingerprint: 74.115.204.51 relay-hub201.domainlocalhost.com Received: from [74.115.204.51] ([74.115.204.51:39534] helo=relay-hub201.domainlocalhost.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 0E/69-29764-C17DD705 for ; Tue, 16 Oct 2012 17:52:34 -0400 Received: from MBX202.domain.local ([169.254.169.44]) by HUB201.domain.local ([192.168.68.45]) with mapi id 14.02.0283.003; Tue, 16 Oct 2012 17:51:30 -0400 To: Stas Malyshev CC: "internals@lists.php.net" Thread-Topic: [PHP-DEV] [PHP-DEV [RFC] Property Accessors v1.2 : Interfaces Thread-Index: Ac2qzmY/IrEbFiHmS8CRVRSeKx1+9gA1OcmAAAbzj+D//+E4AIAAPK/A///e5wCAAFXGiQ== Date: Tue, 16 Oct 2012 21:51:30 +0000 Message-ID: References: <9570D903A3BECE4092E924C2985CE485612B6466@MBX202.domain.local> <507D2AB5.1000903@sugarcrm.com> <9570D903A3BECE4092E924C2985CE485612B6C88@MBX202.domain.local> <507D3F8A.5040402@sugarcrm.com> <9570D903A3BECE4092E924C2985CE485612B6DF5@MBX202.domain.local>,<507D56AE.8020101@sugarcrm.com> In-Reply-To: <507D56AE.8020101@sugarcrm.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [PHP-DEV] [PHP-DEV [RFC] Property Accessors v1.2 : Interfaces From: cpriest@zerocue.com (Clint Priest) My choice of words were misleading/incorrect. If you are programming to an= interface then the interface dictates what *will* work, if you attempt to = use an interface to do something that the interface has not declared is sup= ported then it may work or it may fail. On Oct 16, 2012, at 7:43 AM, "Stas Malyshev" wrote= : > Hi! >=20 >> If you have a public property $a which internally can only deal with >> it being set to 2 or 3 and someone external to the class sets it to >> 4, your class either has to check that it's 2 or 3 and deal with the >> fact that it is now 4 or have indeterminate results when it is set to >> 4. >=20 > Most of the properties, however, aren't of that nature. >=20 >> The use case is that you are declaring that interface a must allow a >> property $xyz to be readable and *not* writable. >=20 > Why would you require for the implementor to *not* be able to do > something? Interfaces were never used to make class *not* be able to do > something. Are you sure it's good thing to introduce this? I think it's > not. I think interfaces should only define "X should work" but not "Y > should not work". >=20 >> Class b does not satisfy the requirement because you are missing the >> fact that public $xyz { get; } forbids setting of $xyz, only reading >> it. >=20 > See above, I think it's not the right use of interfaces. Also, error > message produced has nothing in common with this logic. > --=20 > Stanislav Malyshev, Software Architect > SugarCRM: http://www.sugarcrm.com/ > (408)454-6900 ext. 227