Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:63556 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 21913 invoked from network); 20 Oct 2012 09:49:39 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Oct 2012 09:49:39 -0000 Authentication-Results: pb1.pair.com smtp.mail=tbprogrammer@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=tbprogrammer@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.219.42 as permitted sender) X-PHP-List-Original-Sender: tbprogrammer@gmail.com X-Host-Fingerprint: 209.85.219.42 mail-oa0-f42.google.com Received: from [209.85.219.42] ([209.85.219.42:51757] helo=mail-oa0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 7F/DC-22055-1B372805 for ; Sat, 20 Oct 2012 05:49:38 -0400 Received: by mail-oa0-f42.google.com with SMTP id j1so1287397oag.29 for ; Sat, 20 Oct 2012 02:49:34 -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=QpwBjnIzo0xNwnx4tIhDjLY9LO8+PU+4QrOPcXcCO90=; b=IVxskH0uYxlsE9Y7OCw+h7B6IbkDwOeNLytlZpsdp5lCZiIsWyrQL3/LtJoooOuYQR WTULc+x9kyMdZn97YtGRmzivh0VrLvkYMPO29bGktwX/34DoNJXnNTqyoUaWZwaOoWN1 pA4yEVgk3bp9g1ZvJ0MfLaW4R+RqTQUh23IQYgq9Wx8o4a15ir9drPSo92+gIcn3SgwA cSNrhnRKQ7w7kN6NfmLsUMqYWlIqmxlJV2e+Y2szrRJTAMV+72HFyet4BvLFsTrQ819y CzKxiVdUo2YIoimS2rxMR9gr4ZKvy+ujTvHMbNiwszGlJfie+OoAqbaksgrhIIzQ9qyb P40Q== Received: by 10.60.170.202 with SMTP id ao10mr3503549oec.135.1350726574048; Sat, 20 Oct 2012 02:49:34 -0700 (PDT) MIME-Version: 1.0 Received: by 10.76.11.170 with HTTP; Sat, 20 Oct 2012 02:49:13 -0700 (PDT) In-Reply-To: <508271A2.40200@sugarcrm.com> References: <9570D903A3BECE4092E924C2985CE485612C2595@MBX214.domain.local> <508271A2.40200@sugarcrm.com> Date: Sat, 20 Oct 2012 02:49:13 -0700 Message-ID: To: Stas Malyshev Cc: Clint Priest , "internals@lists.php.net" Content-Type: multipart/alternative; boundary=bcaec54a3548a284e304cc7a8934 Subject: Re: [PHP-DEV] [RFC] Accessors : read-only / write-only keywords From: tbprogrammer@gmail.com (Jazzer Dane) --bcaec54a3548a284e304cc7a8934 Content-Type: text/plain; charset=ISO-8859-1 I'll agree with you in regards to your analysis of Clint's proposed syntax. In terms of your questioning the idea around "read-only", this is how I think about it: Class A created property accessor $z that you can not set. Class B can extend me just fine, but they can not alter that basic rule that I laid out for my and all my children's property accessor $z: You can not set it. This makes sense to me, and I feel like it is control that the developer should have. If we were to translate *final set NULL;* (or whatever implementation we choose to use) to a more manual implementation, it may look something like this: public $property { > final get() { ... } > final set($value) { throw new Exception("You can't set $property. It is > read only."); } > } > On Sat, Oct 20, 2012 at 2:40 AM, Stas Malyshev wrote: > Hi! > > > get() { return $this->Hours; } > > final set NULL; > > It looks like some unobvious piece of magic - what exactly "set NULL" > means? There's no obvious parsing of this thing for somebody that > doesn't already know what the magic means. I'd rather have people > implement a method throwing exception manually than have this. It's > unclear what is relationship between "set" (is it a variable? a > constant? a method?) and "NULL" (what NULL here means? is it assignment > of NULL to set? is it declaration of NULL with type "set"?) and it does > not parse naturally with almost any background. > > Thinking about it for a while, the whole idea of "this class can never > have this method implemented" looks a bit strange to me - I don't think > I've ever encountered such concept in OOP. You can say "I implement it > this way and you can't override it" but NULL does not suggest any > natural implementation. > > -- > Stanislav Malyshev, Software Architect > SugarCRM: http://www.sugarcrm.com/ > (408)454-6900 ext. 227 > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --bcaec54a3548a284e304cc7a8934--