Re: [RFC] Unary null coalescing operator
| From: | Fleshgrinder | Date: | Wed, 21 Jun 2017 17:14:15 +0000 |
| Subject: | Re: [RFC] Unary null coalescing operator | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-99595@lists.php.net to get a copy of this message | ||
On 6/21/2017 7:05 PM, Andrea Faulds wrote:
> Hi all,
>
> Here's a small RFC for a small feature, which I've wondered about for a
> while: https://wiki.php.net/rfc/unary_null_coalescing_operator
>
> What do you think of it?
>
> Thanks!
I would prefer [1] to be extended to any and everything that can be
null, like Kotlin, Ceylon, and others have it. Otherwise one needs to
change back and forth between one and two question marks depending on
context.
The null coalesce operator is more of a special form of the ternary
operator, but this proposal is a different beast and closer to nullable
types than to the ternary operator. Hence, using a single question mark
comes more natural.
[1] https://wiki.php.net/rfc/nullsafe_calls
--
Richard "Fleshgrinder" Fussenegger
Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc
Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc