Null-Coalescing Operator and Extensions

Basile B. b2.temp at gmx.com
Tue Aug 28 01:18:35 UTC 2018


On Monday, 27 August 2018 at 14:59:20 UTC, SG wrote:
> On Monday, 27 August 2018 at 07:59:17 UTC, Simen Kjærås wrote:
>> That's the null propagation operator (?.). What SG asked for 
>> is the null-coalescing operator (??). Of course, this can also 
>> be implemented in D (albeit with a slight more horrible 
>> syntax):"

IMO not to have the Elvis operator in D (actually "??" is less 
interesting than the Elvis "?:" because of D automatic 
dereference and also because of boolean eval of stuff like 
integers and classes instances or pointer) is not a huge issue.

Not to have the safe access operator is more a problem. One is 
about having shorter ternary expressions (Elvis), the other is 
about saving sometimes 4 or 5 "&&" with at new "&&" a longer 
unary (Safe access).


More information about the Digitalmars-d-learn mailing list