Existential operator (was: ||= is much needed?)

Brendan Eich brendan at mozilla.org
Tue Jun 19 12:21:12 PDT 2012


Allen Wirfs-Brock wrote:
> I don't agree, probably because I'm look at ?. as an operator that evaluates to a special kind of  Reference.

That your alternative off-by-one in its basis case is bad enough -- it 
creates two error suppression points from one syntactic extension-point, 
it will hide bugs, it is gratuitously different from CoffeeScript, and 
it prevents using the ?( analogue on an unqualified identifier.

Worse, instead of leaking an observable ConditionalReference (whew!), 
you've opted to break the equivalence between foo.bar() and %tmp = 
foo.bar; %tmp.call(foo) for the case where . is replaced by ?. -- in 
this case your proposal does not throw while the expansion does.

The right extension for what CoffeeScript calls ?( is simply to use an 
unambiguous and backward-compatible extension, such as ?.( instead.

> The risk is in adding precisely CoffeeScript ?. in haste without thinking through implications of not also having ?().  It may mean a different variant of ?. semantics would work better in our case.

I'm not adding anything in haste, and CoffeeScript has been around, 
what, three years. The haste here seems to be on the other foot :-|.

Also, I do not think we should extend Reference types in the spec if we 
can help it. These must boil away in optimizing implementations, always. 
Elaborating them risks leaks or more subtle dependencies happening as 
unintended consequences.

/be



More information about the es-discuss mailing list