Re: [RFC][Vote] Typed Properties
| From: | flaupretre at free dot fr | Date: | Thu, 26 May 2016 09:05:26 +0000 |
| Subject: | Re: [RFC][Vote] Typed Properties | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-93552@lists.php.net to get a copy of this message | ||
Hi Dmitry,
>
> I thought about a different approach :)
>
>
> - not-nullable typed properties must be explicitly initialized (or
> should be initialized implicitly by corresponding types, e.g. "int"
> should get default value int(0). ...)
>
> - nullable typed properties may be implicitly initialized by NULL
> (like untyped properties now).
>
> - unset() of typed properties should not be allowed
>
>
> This would allow to eliminate few weird run-time checks in VM and
> allow the most efficient usage of type information in Optimizar and
> JIT.
For scalar types, that's fine but, in practice, it forces object properties to be nullable, as
they cannot be initialized explicitely.
Regards
François