Adding the ?. null verification

Etienne via Digitalmars-d digitalmars-d at puremagic.com
Wed Jun 18 08:50:34 PDT 2014


> C# is getting the same syntax, and I remember there being some
> discussion about it here. It's somewhat useful I suppose, though I think
> it's made significantly more useful in C# with 'a ?? b' (a if a is not
> null, else b).


I've seen too many bugs where you end up dereferencing a null pointer, 
also with the -> being replaced by . in D this is even more confusing 
when you switch a member from a pointer to a struct. The compiler could 
easily advise you to use the .? notation when you're moving in too deep 
into no man's land.


More information about the Digitalmars-d mailing list