Re: [RFC] anti-coalescing-operator
| From: | Ken Stanley | Date: | Thu, 24 Oct 2019 22:49:28 +0000 |
| Subject: | Re: [RFC] anti-coalescing-operator | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-107679@lists.php.net to get a copy of this message | ||
On Thu, Oct 24, 2019 at 6:01 PM Mark Randall <marandall@php.net> wrote:
> On 24/10/2019 22:52, Ken Stanley wrote:
> > I'm more interested in having a negation operator for the null-coalescing
> > operator, especially since cognatively it should be easy to discern what
> it
> > does.
>
> At the point your syntax ends up looking like you're screaming at your
> source code, I think easy cognition has likely gone out the window.
>
> There are plenty of much more expressive ways of doing this without
> introducing new syntax IMHO.
Mark,
Yes, the operator would be new as in it doesn’t exist, but it’s not new in
the fact that it is simply a negation of an existing operator.
I would be keen to see the more expressive techniques that retain the
succinctness of having a not-null coalescing operator.
I can certainly appreciate the hesitation to introduce more syntax.
However, I am arguing that this particular case is merely an extension
(compliment) of the existing null-coalescing operator and therefore it’s
not truly new; especially since !== null is a very common comparison used
in programming.
>
> Mark Randall
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
Thank you.
>
|> is not something new it appeared in many languages long
> time ago (in
some forms). JavaScript also has a proposal of it. And PHP someone has
already proposed one.
> https://github.com/tc39/proposal-pipeline-operator
> https://wiki.php.net/rfc/pipe-operator
Kosit,
Thank you. In this case I’d still argue that my proposed operator, for what
I’m intending it to be, is the better solution.
I appreciate that my example might not have been the best, but I wanted to
demonstrate one possible usage out of many that could be used to easily
solve the same problem of needing to do “something” based on a non-null
value.
Thank you!
--
"Do not go gentle into that good night. Rage, rage against the dying of the
light." — Dylan Thomas