Open dead-claudia opened 1 day ago
I agree that optional chaining would be a logical extension of this proposal. The next time it gets presented to the committee plenary, I might raise it as a possible extension. Since the Committee tends in my experience to be conservative and incremental with regards to syntax, it might deferred to a future proposal.
I'm thinking this, to align it fully with object methods.
receiver?~>fn()
:receiver == null ? undefined : fn.call(receiver)
receiver~>fn?.()
:typeof fn !== "function" ? undefined : fn.call(receiver)
receiver?~>fn?.()
:receiver == null || typeof fn !== "function" ? undefined : fn.call(receiver)