Re: Re: Typed properties patch
| From: | Stanislav Malyshev | Date: | Thu, 14 Apr 2016 17:26:47 +0000 |
| Subject: | Re: Re: Typed properties patch | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-92306@lists.php.net to get a copy of this message | ||
Hi!
> I didn't understand.
> Of course we keep a class definition, where the type of property "$a" -
> IS_LONG, but the actual value of "$a" may become IS_UNDEF.
What I'm saying is maybe it's fine.
> In PHP-7 we check for IS_LONG without type hint.
> With type hint and ability to unset(), we will have to check for IS_LONG
> anyway.
Well, we'd have to check for IS_UNDEF, but we won't have to choose
between IS_LONG, IS_OBJECT and IS_RESOURCE.
> So type hinting won't improve reading performance, but writing is going
> to be slower, because we have to perform type check.
> So even theoretically this approach couldn't make any improvement.
Maybe I misunderstand what performance improvements there are. Do we do
different things when reading a variable depending on type? I thought
it's for *operations* with variables, but for just reading them it
doesn't matter. For operations, we could have instead of function
handling all types just function handling IS_LONG and a small check for
UNDEF inside.
I think it is mych better than a weird concept of non-unsettable variable.
--
Stas Malyshev
smalyshev@gmail.com