Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:63346 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 40972 invoked from network); 11 Oct 2012 11:54:17 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 Oct 2012 11:54:17 -0000 Authentication-Results: pb1.pair.com header.from=andre.romcke@ez.no; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=andre.romcke@ez.no; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain ez.no designates 65.55.88.15 as permitted sender) X-PHP-List-Original-Sender: andre.romcke@ez.no X-Host-Fingerprint: 65.55.88.15 tx2ehsobe005.messaging.microsoft.com Received: from [65.55.88.15] ([65.55.88.15:22156] helo=tx2outboundpool.messaging.microsoft.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E2/B1-32023-863B6705 for ; Thu, 11 Oct 2012 07:54:16 -0400 Received: from mail265-tx2-R.bigfish.com (10.9.14.235) by TX2EHSOBE009.bigfish.com (10.9.40.29) with Microsoft SMTP Server id 14.1.225.23; Thu, 11 Oct 2012 11:54:13 +0000 Received: from mail265-tx2 (localhost [127.0.0.1]) by mail265-tx2-R.bigfish.com (Postfix) with ESMTP id 8FB461B80136; Thu, 11 Oct 2012 11:54:13 +0000 (UTC) X-Forefront-Antispam-Report: CIP:157.56.249.213;KIP:(null);UIP:(null);IPV:NLI;H:AM2PRD0710HT003.eurprd07.prod.outlook.com;RD:none;EFVD:NLI X-SpamScore: -5 X-BigFish: PS-5(zz98dI9371I1102I1432I1418Izz1d18h1202h1d1ah1d2ahzz8275ch8275bhz2fh2a8h668h839hd25he5bhf0ah107ah1288h12a5h12a9h12bdh137ah13b6h1441h1155h) Received-SPF: pass (mail265-tx2: domain of ez.no designates 157.56.249.213 as permitted sender) client-ip=157.56.249.213; envelope-from=andre.romcke@ez.no; helo=AM2PRD0710HT003.eurprd07.prod.outlook.com ;.outlook.com ; Received: from mail265-tx2 (localhost.localdomain [127.0.0.1]) by mail265-tx2 (MessageSwitch) id 1349956451359381_20421; Thu, 11 Oct 2012 11:54:11 +0000 (UTC) Received: from TX2EHSMHS032.bigfish.com (unknown [10.9.14.242]) by mail265-tx2.bigfish.com (Postfix) with ESMTP id 4C22C1C00044; Thu, 11 Oct 2012 11:54:11 +0000 (UTC) Received: from AM2PRD0710HT003.eurprd07.prod.outlook.com (157.56.249.213) by TX2EHSMHS032.bigfish.com (10.9.99.132) with Microsoft SMTP Server (TLS) id 14.1.225.23; Thu, 11 Oct 2012 11:54:10 +0000 Received: from AM2PRD0710MB351.eurprd07.prod.outlook.com ([169.254.9.133]) by AM2PRD0710HT003.eurprd07.prod.outlook.com ([10.255.165.38]) with mapi id 14.16.0207.009; Thu, 11 Oct 2012 11:54:09 +0000 To: Clint Priest CC: Jazzer Dane , "internals@lists.php.net" Thread-Topic: [PHP-DEV] [RFC] Propety Accessors v1.1 Thread-Index: Ac2lRqaw0wLAVcGGQAyyWuaNO91x4QASet+AAASYmYAAAETXgAAAKxEAAAWM04AABBwsAAAJtrUAAAEUaoAAVHcUgAADlLiAAAFw9IAAEqnCAA== Date: Thu, 11 Oct 2012 11:54:08 +0000 Message-ID: References: <9570D903A3BECE4092E924C2985CE485612B3B48@MBX202.domain.local> <5073328D.5000002@gmail.com> <50735165.8010703@aaronholmes.net> <9570D903A3BECE4092E924C2985CE485612B4353@MBX202.domain.local> <760ab4f994a78a846cf86aafda71e0e2@mohiva.com> <9570D903A3BECE4092E924C2985CE485612B4EFE@MBX202.domain.local> <9570D903A3BECE4092E924C2985CE485612B4F63@MBX202.domain.local> In-Reply-To: <9570D903A3BECE4092E924C2985CE485612B4F63@MBX202.domain.local> Accept-Language: nb-NO, de-DE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.255.165.4] Content-Type: text/plain; charset="iso-8859-1" Content-ID: <323281EECC7DCE49AE405CE01375209D@eurprd07.prod.outlook.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: ez.no Subject: Re: [PHP-DEV] [RFC] Propety Accessors v1.1 From: andre.romcke@ez.no (=?iso-8859-1?Q?Andr=E9_R=F8mcke?=) On Oct 11, 2012, at 4:59 AM, Clint Priest wrote: > Why is everyone so dead set against read-only and write-only? >=20 > I could not disagree more with you on what is "pretty" and "readable". >=20 > To me: >=20 > public read-only $hours { > get { ... } > } >=20 > Is infinitely more readable and understandable than: >=20 > public $hours { > get() { ... } > private final set($value) { ... } > } >=20 > The latter implies that it can be "set" within the right context (interna= lly to the class), which is precisely the opposite of what is desired (read= only). If it can be used on normal properties as well (w/o the overhead of functio= n calls) then: +1 Otherwise it would not be consistent to introduce it. On the topic of consistency, could not see any other keyword in php that us= es hyphen in it. >=20 > 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 >=20 > This all sounds about right. >=20 > 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 lo= gical point of view, I prefer read-only/write-only. >=20 > private final get() {} is technically saying it will always return null. > private final set() {} is technically saying that setting doesn't do anyt= hing - but it still works. >=20 > But I don't see any sane scenario where someone would want to do the abov= e. Therefore, it may just be best to use them in place of the currently pro= posed 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 R= FC. >=20 > To sum up the last few days of conversations, I have these down as points= of contention: >=20 > 1. Accessor functions should not be present on the object and callable d= irectly, for example, $o->__getHours() should not be allowed. > 2. Preferred syntax for accessors should be "public set($value) { ... }"= with no "magic" $value (with possible type hinting) > 3. Automatically implemented get; set; with auto-backing field should be= eliminated 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= is 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 = for accessors > 6. The "truth" of reflection. Should it reveal details internal to how = PHP works on the inside or should it reflect the way PHP presents it as opt= ions? >=20 > Did I miss anything? >=20 >=20 > I will come up with some way for people to vote on the issues at hand and= we can cast our votes and be done with it, then I will finish the project = and get it out the door. >=20 > -Clint >=20