Safe Navigation Operator “?.” for D2 ?

Chris Williams yoreanon-chrisw at yahoo.co.jp
Thu Feb 27 07:14:59 PST 2014


On Thursday, 27 February 2014 at 13:27:14 UTC, Remo wrote:
>
> Apparently C# will get it in the next version.
> http://blogs.msdn.com/b/jerrynixon/archive/2014/02/26/at-last-c-is-getting-sometimes-called-the-safe-navigation-operator.aspx
>
> What do you think how well would this work in D2 ?

I like it. At my previous job, I extended std.json with an array 
index operator just to end up replacing it with a variadic getter 
to get around the problem of incomplete paths. Like that, there 
are some ways to get around this sort of issue, but I wouldn't 
complain about having it right out of the box.

Perhaps there should also be a ?[] operator.

foo?["a"]?[0]?["llama"]


More information about the Digitalmars-d mailing list