-
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 != nil ? MyObj.Method1() : "default" So may I petition to make |
Beta Was this translation helpful? Give feedback.
Answered by
antonmedv
Dec 16, 2024
Replies: 2 comments
-
Yes! It will be super nice to have it. Please create an issue. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
xiaoas
-
I'll close this discussion. Future update should be in this issue |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yes! It will be super nice to have it. Please create an issue.