Nullable condition operator
Martin6265 via Digitalmars-d
digitalmars-d at puremagic.com
Mon Dec 14 05:19:13 PST 2015
I dont said C# is better, just missing some preferred stuffs from
other languages.
`.?` from C# is same thing as message passing in ObjC. (You can
send message to invalid object without accessing null pointer).
And I miss that stuff in D.
Maybe will create a new instance of T if T is null, right?
class Responder {
Responder m_parent;
void SetSomething(int a) {
m_parent.maybe.SetSomething(a);
}
}
So, this example will ends in infinite loop.
But I don't want to call SetSomething on m_parent if m_parent is
null.
More information about the Digitalmars-d
mailing list