Re: Non-nullable properties
| From: | Rowan Collins | Date: | Thu, 19 Jul 2018 15:01:58 +0000 |
| Subject: | Re: Non-nullable properties | ||
| References: | 1 2 3 4 5 6 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-102918@lists.php.net to get a copy of this message | ||
On 19 July 2018 at 15:20, Christoph M. Becker <cmbecker69@gmx.de> wrote:
> It seems to me that either of these proposals would render the lazy
> initialization pattern outlined in the “Overloaded Properties”
> section[1] invalid.
>
> [1]
> <https://wiki.php.net/rfc/typed_properties_v2#overloaded_properties>
>
Hm, I guess I didn't read that section carefully enough.
It strikes me that that entire code pattern is a hack due to lack of
property accessors, and it seems a shame to reduce the usefulness of the
language's type system just to support it.
From the responses on this thread, I get the feeling I'm in the minority,
but it still feels utterly wrong to me that a property marked as
non-nullable offers no guarantee at all that it will actually hold a valid
value.
Regards,
--
Rowan Collins
[IMSoP]