Safe Navigation Operator “?.” for D2 ?

Boyd gaboonviper at gmx.net
Sun Mar 2 07:18:31 PST 2014


While at the moment it may seem like a must have feature. If D is 
going to get better nullability handling, like the proposed 
@nullable or Nullable!X, then the safe navigation operator is not 
really needed. The explicit nullability would provide the needed 
safety.

auto x = parent.child.child.child; // error, result may be null
@nullable auto x = parent.child.child.child; // no error

I'd definitely prefer that to a weird operator that may also 
conflict with the inline if statement.



More information about the Digitalmars-d mailing list