proposal-call-this icon indicating copy to clipboard operation
proposal-call-this copied to clipboard

Optional chaining support?

Open dead-claudia opened this issue 1 year ago • 1 comments

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)

dead-claudia avatar Oct 19 '24 08:10 dead-claudia

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.

js-choi avatar Oct 20 '24 01:10 js-choi