Re: [RFC] Readonly Properties
| From: | Andrea Faulds | Date: | Fri, 24 Oct 2014 07:50:15 +0000 |
| Subject: | Re: [RFC] Readonly Properties | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-78292@lists.php.net to get a copy of this message | ||
> On 24 Oct 2014, at 06:09, Xinchen Hui <laruence@php.net> wrote:
> so you prefer to expose the name of the property anywhere?
>
> let's say you expose a readonly int value name iSize..
>
> but later, the value also need to be a double,
>
> then you also prefer add another dval? (since you can not simple
> change ival name, since it was exposed)
Is that not already a problem with functions? You can't change their names. If you do change
its name, you can add a __get.
> I knew this of course, but this is actually not related to this
> specific "readonly" RFC
>
> but if you are strict to this., then I'd like to say, this will
> slowdown all FETCH_OBJ_R a bit, since this will need introduce a
> condition to check whether a property is readonly.. only faster a
> narrow case...
Right, it will theoretically make public and protected property lookups ever-so-slightly slower.
I'll need to benchmark it as I doubt it's a big deal in practice.
Though this could be worked around by making the write check be a different function. Or by
inlining.
--
Andrea Faulds
http://ajf.me/