Broad inclusion of operators · Issue #4 · tc39/proposal-optional-chaining (original) (raw)

This repository was archived by the owner on Jan 25, 2022. It is now read-only.

This repository was archived by the owner on Jan 25, 2022. It is now read-only.

@littledan

Description

@littledan

This proposal includes not just ?. but also ?.[ and ?.(. It's easy to see why ?. is useful when navigating around a JSON document, and ?.[ may be for analogous situations, but the method call and constructor parts are a bit more obscure. Are these included out of an abstract sense of orthogonality, or were there particular use cases in mind that motivated them? If so, it would be good to include them in the explainer. IIRC the number of operators here was brought up at the January 2017 TC39 meeting as a point to revisit with an eye towards starting more minimally. cc @dherman