Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:63336 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 6279 invoked from network); 11 Oct 2012 03:00:31 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 Oct 2012 03:00:31 -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.41 as permitted sender) X-PHP-List-Original-Sender: cpriest@zerocue.com X-Host-Fingerprint: 74.115.204.41 relay-hub205.domainlocalhost.com Received: from [74.115.204.41] ([74.115.204.41:59158] helo=relay-hub205.domainlocalhost.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id BB/60-04101-D4636705 for ; Wed, 10 Oct 2012 23:00:30 -0400 Received: from MBX202.domain.local ([169.254.169.44]) by HUB205.domain.local ([192.168.68.49]) with mapi id 14.02.0283.003; Wed, 10 Oct 2012 22:59:40 -0400 To: Jazzer Dane CC: "internals@lists.php.net" Thread-Topic: [PHP-DEV] [RFC] Propety Accessors v1.1 Thread-Index: AQHNpfaE0wLAVcGGQAyyWuaNO91x4ZezPRQAgABndID//8fU0A== Date: Thu, 11 Oct 2012 02:59:45 +0000 Message-ID: <9570D903A3BECE4092E924C2985CE485612B4F63@MBX202.domain.local> References: <9570D903A3BECE4092E924C2985CE485612B3B48@MBX202.domain.local> <5073328D.5000002@gmail.com> <50735165.8010703@aaronholmes.net> <9570D903A3BECE4092E924C2985CE485612B4353@MBX202.domain.local> <760ab4f994a78a846cf86aafda71e0e2@mohiva.com> <9570D903A3BECE4092E924C2985CE485612B4EFE@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.27] Content-Type: multipart/alternative; boundary="_000_9570D903A3BECE4092E924C2985CE485612B4F63MBX202domainloc_" MIME-Version: 1.0 Subject: RE: [PHP-DEV] [RFC] Propety Accessors v1.1 From: cpriest@zerocue.com (Clint Priest) --_000_9570D903A3BECE4092E924C2985CE485612B4F63MBX202domainloc_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Why is everyone so dead set against read-only and write-only? I could not disagree more with you on what is "pretty" and "readable". To me: public read-only $hours { get { ... } } Is infinitely more readable and understandable than: public $hours { get() { ... } private final set($value) { ... } } The latter implies that it can be "set" within the right context (internall= y to the class), which is precisely the opposite of what is desired (read o= nly). From: Jazzer Dane [mailto:tbprogrammer@gmail.com] Sent: Wednesday, October 10, 2012 9:18 PM To: Clint Priest Cc: internals@lists.php.net Subject: Re: [PHP-DEV] [RFC] Propety Accessors v1.1 This all sounds about right. In regards to #4 - read-only/write-only: I think that, from a "pretty syntax" point of view, private final set() {} = and private final get() {} are definitely our best bets. But... from a logi= cal point of view, I prefer read-only/write-only. private final get() {} is technically saying it will always return null. private final set() {} is technically saying that setting doesn't do anythi= ng - but it still works. But I don't see any sane scenario where someone would want to do the above.= Therefore, it may just be best to use them in place of the currently propo= sed read-only/write-only. On Wed, Oct 10, 2012 at 5:35 PM, Clint Priest > wrote: Okay, I would like this to be the last time there are revisions to this RFC= . To sum up the last few days of conversations, I have these down as points o= f contention: 1. Accessor functions should not be present on the object and callable dir= ectly, for example, $o->__getHours() should not be allowed. 2. Preferred syntax for accessors should be "public set($value) { ... }" w= ith no "magic" $value (with possible type hinting) 3. Automatically implemented get; set; with auto-backing field should be e= liminated as this is not necessary for PHP and is confusing most everyone. 4. read-only / write-only keywords, keep them or get rid of them? There i= s no directly suitable replacement but I believe a private final set() { } = will take care of it, even though it much more verbose. 5. Error handling for thrown exceptions should be made more appropriate fo= r accessors 6. The "truth" of reflection. Should it reveal details internal to how PH= P works on the inside or should it reflect the way PHP presents it as optio= ns? Did I miss anything? I will come up with some way for people to vote on the issues at hand and w= e can cast our votes and be done with it, then I will finish the project an= d get it out the door. -Clint --_000_9570D903A3BECE4092E924C2985CE485612B4F63MBX202domainloc_--