Re: [RFC] Accessors : read-only / write-only keywords
| From: | Pierre Joye | Date: | Sat, 20 Oct 2012 10:15:13 +0000 |
| Subject: | Re: [RFC] Accessors : read-only / write-only keywords | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-63558@lists.php.net to get a copy of this message | ||
On Sat, Oct 20, 2012 at 1:07 AM, Clint Priest <cpriest@zerocue.com> wrote:
> I had thought of a deviation on some of the ideas presented to get rid of read-only/write-only
> while still keeping the ability to maintain their effect, if we so decide that the feature is
> wanted. Here it is:
>
> class TimePeriod {
> private $Seconds;
>
> public $Hours {
> get() { return $this->Hours; }
> final set NULL;
> }
> }
>
> It's close to what's been suggested but is pretty clear that there IS NO SETTER it
> could not be called within the class and since its final it cannot be over-ridden. I've
> included this in the change tracking document.
>
> Thoughts?
Sorry but I don't like it, it makes me think that there is no setter
but I could set the property manually (yes, that's not an actual one
but putting myself in the shoes of a lambda user).
I actually prefer the read-only syntax, while we have to make it clear
and not confusin (see Niki's reply in this post).
Cheers,
--
Pierre
@pierrejoye | http://blog.thepimp.net | http://www.libgd.org