Existential operator (was: ||= is much needed?)
Brendan Eich
brendan at mozilla.org
Tue Jun 19 12:26:30 PDT 2012
Brendan Eich wrote:
> 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.
Jeremy pointed out privately that the need for ?( is less acute in
practice, and also because of .call via the equivalences:
foo.bar?(args) <==> foo.bar?.call(foo, args)
fun?(args) <==> fun?.call(undefined, args)
But ?.( is shorter. It's awkward to use three chars instead of
CoffeeScript's two, and to have a dot in the middle where no get or set
is implied.
/be
More information about the es-discuss
mailing list