Existential operator (was: ||= is much needed?)
brendan at mozilla.org
Thu Jun 21 08:23:37 PDT 2012
John Tamplin wrote:
> So do you have to do it by treating the ?. operator as a standalone?
Not sure what you mean here -- "standalone ?" (with an English-langauge
? implied after in your sentence? ;-)?
Or something else that amounts to a concealed Reference or
Just talking spec here: as Allen mentioned, ECMA-262 specifies semantics
by evaluating productions in a mostly-LR(1) grammar, so member and call
expressions (left-associative) have to result in some kind of
(spec-internal or language-external) value.
Thus foo?.bar.baz.quux is really (((foo?.bar).baz).quux).
> Instead, could you do the "indefinte soak" part during parsing,
> treating the rest of the expression differently after having seen a ?.
Indeed one can translate when parsing. CoffeeScript does this, with some
separate passes for its other purposes (implicitly declared variables,
indentation-based block structure, etc.).
The ES specs can't do this, though, not without a total rewrite.
> John A. Tamplin
> Software Engineer (GWT), Google
> es-discuss mailing list
> es-discuss at mozilla.org
More information about the es-discuss