Optional Chaining (original) (raw)

1 Scope

This is the spec text of the Optional Chaining proposal in ECMAScript.

For the syntax, we use the ?. token, with a lookahead at the level of the lexical grammar that allows to discriminate between a?.b (optional chaining) and a?.3:0 (conditional operator, whose meaning cannot be changed due to backward compatibility constraints).

An early version of this proposal used a Nil reference to express short-circuiting. This one is based on syntax only.

Normative additions are marked like this. In order to avoid distraction, we may omit mere editorial amendments.

List of significant editorial modifications:

The following features may not be evident at a cursory read: