Project Elvis

H. S. Teoh hsteoh at quickfur.ath.cx
Thu Nov 2 16:46:06 UTC 2017


On Thu, Nov 02, 2017 at 12:50:47PM +0000, Nick Treleaven via Digitalmars-d wrote:
[..]
> I'd like to mention null-coalescing assignment syntax. Perl has `$a
> //= $b`, and PHP has voted to support `$a ??= $b`, expanding to `$a =
> $a ?? $b`.
[...]
> I expect D could do the same with `a ?:= b` or use the `??` operator syntax.

Isn't the `??` syntax what the Elvis operator `?:` supposed to do?

Given that the proposed Elvis operator would be `?:`, I'd expect the
corresponding assignment operator would be `?:=`, in following the
pattern of the other op-assign operators.


> Just from memory, I think I would use null coalescing assignments more
> than null coalescing comparisons.

If we're going to have one of them, might as well have both.


T

-- 
I think the conspiracy theorists are out to get us...


More information about the Digitalmars-d mailing list