On Fri, 17 Jul 2020 at 10:05, Ilija Tovilo <tovilo.ilija@gmail.com> wrote:
>
> Hi internals
>
> I started the vote on the nullsafe operator RFC.
> https://wiki.php.net/rfc/nullsafe_operator
>
> The vote closes on 2020-07-31.
I'm voting yes.
From the discussions I've seen, there are two overlapping reasons
people have said for why they don't like this proposal.
"checking that the value is null should be a red flag that something
is wrong with the data model."
Even if there is something wrong with the data model, programmers are
often in a position where they can't change the data model.
That can be because it's part of an api/library that's provided by a
3rd party, or is part of a legacy code base that can't be refactored
right now.
PHP exists to be useful. Adding a small feature that makes it easier
to work with some data models is a useful thing to do.
But also, sometimes the data just is null.
Whether you use a null type, a type union, Option<T>, a Nothing-type
or whatever, it's got to be handled somewhere. This RFC provides a way
of handling it in a way that is very easy to write and read, imo.
I realise that some people would prefer to not use this syntax in
their own code, which is fine. But as it makes coding easier for other
people, I hope people would only vote no for a stronger reason than
they would personally prefer not to use it.
cheers
Dan
Ack