Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:63320 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 8054 invoked from network); 10 Oct 2012 12:03:14 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 10 Oct 2012 12:03:14 -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.40 as permitted sender) X-PHP-List-Original-Sender: cpriest@zerocue.com X-Host-Fingerprint: 74.115.204.40 relay-hub204.domainlocalhost.com Received: from [74.115.204.40] ([74.115.204.40:50257] helo=relay-hub204.domainlocalhost.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 35/33-23031-10465705 for ; Wed, 10 Oct 2012 08:03:14 -0400 Received: from MBX202.domain.local ([169.254.169.44]) by HUB204.domain.local ([192.168.68.48]) with mapi id 14.02.0283.003; Wed, 10 Oct 2012 08:02:31 -0400 To: Leigh , Bernhard Schussek CC: "internals@lists.php.net" Thread-Topic: [PHP-DEV] [RFC] Propety Accessors v1.1 Thread-Index: Ac2lRqaw0wLAVcGGQAyyWuaNO91x4QBHSfMAABNVRgAAB5uHkAADVLMAAAOZVoAAAy9RgA== Date: Wed, 10 Oct 2012 12:02:30 +0000 Message-ID: <9570D903A3BECE4092E924C2985CE485612B4AE2@MBX202.domain.local> References: <9570D903A3BECE4092E924C2985CE485612B3B48@MBX202.domain.local> <9570D903A3BECE4092E924C2985CE485612B496D@MBX202.domain.local> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [192.168.64.21] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: RE: [PHP-DEV] [RFC] Propety Accessors v1.1 From: cpriest@zerocue.com (Clint Priest) > > Second, I'd like to throw in the idea of array accessors. I mentioned > > this before, but did not get any response. > > > > public $Addresses { > > offsetSet($offset, $value) { ... } > > offsetGet() { ... } > > offsetUnset($offset) { ... } > > offsetExists($offset) { ... } > > } >=20 > Definitely on the "nice to have" list. While I agree it would be a "nice to have" it would also be un-necessary. = There are already ways to do precisely what is desired here by way of Array= Access. class Addresses implements ArrayAccess { offsetSet($offset, $value) { ... } offsetGet() { ... } offsetUnset($offset) { ... } offsetExists($offset) { ... } } // In base class where the proposed additional accessor types were suggeste= d public $Addresses =3D new Addresses(); Or if you felt like using an accessor to control access to the Addresses ob= ject, you could implement that as well, but an accessor wouldn't even be ne= cessary. This would provide for cleaner object-oriented principles, the logic for de= aling with acceptance of a new address stays within a class designed to hol= d and control access to the collection of addresses.