Open
Description
Currently, Optional chaining on Object fields work well:
MyObj?.Field1 ?? "default"
However, one cannot make an optional call to a method on an object:
// this panics when MyObj is nil
MyObj?.Method1() ?? "default"
// this does not compile
MyObj?.Method1?.() ?? "default"
So one is forced to write this, which works but is more verbose. Especially when MyObj
is actually a long expression:
MyObj != nil ? MyObj.Method1() : "default"
Expected Behavior
?.()
should be a valid optional function call syntax