Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:63313 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 89445 invoked from network); 10 Oct 2012 07:47:06 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 10 Oct 2012 07:47:06 -0000 Authentication-Results: pb1.pair.com smtp.mail=bschussek@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=bschussek@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.161.170 as permitted sender) X-PHP-List-Original-Sender: bschussek@gmail.com X-Host-Fingerprint: 209.85.161.170 mail-gg0-f170.google.com Received: from [209.85.161.170] ([209.85.161.170:50643] helo=mail-gg0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 8D/00-23031-9F725705 for ; Wed, 10 Oct 2012 03:47:05 -0400 Received: by mail-gg0-f170.google.com with SMTP id q6so43977ggc.29 for ; Wed, 10 Oct 2012 00:47:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=x6Xjd91Zae/UmRrrWOIZbebigY1tZBqaznX1jw7ODXA=; b=UO/vxhI7Z99cZ9mVnakn3jAKbpOKgRWsQLxzcTl4pcnstSscGiKqlKpW/r26cdDcbw BkfKqitQQIIivtLvDi6Zo3SumleyedRDMVwVgV34ll1OxjPbT0hZyf9EE6LHFtGvJ4i8 zESUveNaM/T7TvttVaB6eznmcH7+mIraTLrevYzHddwAmnquqykC8IVt5LIZrZDVeY9n NKCyMcdJEVnTUYc1NiVth+dT7lAO08ge754xN1GcI9iElidoseaLKq9Ccf84zh4+38Sn nb3+4pE74Jozt00o95a1KUSxL3pcmtdOsWGbSzSyOntEd/FsLlavmEB6pYYSA9VoMGBT fpqw== Received: by 10.236.132.65 with SMTP id n41mr10452705yhi.94.1349855222779; Wed, 10 Oct 2012 00:47:02 -0700 (PDT) MIME-Version: 1.0 Received: by 10.100.129.8 with HTTP; Wed, 10 Oct 2012 00:46:32 -0700 (PDT) In-Reply-To: <9570D903A3BECE4092E924C2985CE485612B496D@MBX202.domain.local> References: <9570D903A3BECE4092E924C2985CE485612B3B48@MBX202.domain.local> <9570D903A3BECE4092E924C2985CE485612B496D@MBX202.domain.local> Date: Wed, 10 Oct 2012 09:46:32 +0200 Message-ID: To: Clint Priest Cc: Jazzer Dane , Leigh , =?UTF-8?Q?Johannes_Schl=C3=BCter_=28johannes=40schlueters=2Ede=29?= , "Rasmus Schultz (rasmus@mindplay.dk)" , "Etienne Kneuss (colder@php.net)" , "Nikita Popov (nikita.ppv@googlemail.com)" , "internals@lists.php.net" Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] [RFC] Propety Accessors v1.1 From: bschussek@gmail.com (Bernhard Schussek) Hi Clint, In order to achieve read-only and write-only, we could do something similar to this: /* Explicitly read-only, sub-classes may redefine the getter but may not define a setter */ public $Hours { get() { ... } final private set() {} } This would make the additional keyword superfluous. It's very similar to what is currently done in Singleton classes that usually have private constructors. 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) { ... } } The reasoning for this feature is that in object-oriented design you have to process logic when establishing bidirectional associations between objects. For example, adding an Address to a Contact instance would require Address::$Contact to be set as well if the association is bidirectional. public $Addresses { offsetSet($offset, $address) { $address->Contact = $this; } } $contact->Addresses[] = new Address(); What do you think about supporting this? Cheers, Bernhard