Woah! :) 2012 -- so I correctly recalled "couple of years ago". Thanks,
glad it was discussed in detail.


On Tue, May 20, 2014 at 9:36 AM, Brendan Eich <bren...@mozilla.org> wrote:

> Dmitry Soshnikov wrote:
>
> Will the "Existential Operator" for properly accessors be something
> interesting to consider for ES7 spec? Currently CoffeeScript uses it well.
>
>
> Please see
>
> http://esdiscuss.org/topic/sept-18-tc39-meeting-notes#content-2
>
> and find "ARB: This is non-compositional". Citing text for reader
> convenience:
>
> Existential Operator (strawman discussion)
>
> (Presented by Brendan Eich, Mozilla)
>
> Significant desire include a null and undefined check in syntax/operator
> form (a la coffeescipt)
>
>     o = {}
>     r = o?.p.q.r
>     r = o?.p?.q.r
>
> Mixed discussion about the needs and use cases as they apply to
> coffeescript code.
>
> ARB: This is non-compositional
>
>     o = {}
>     r = o?.p.q.r
>     r = (o?.p).q.r
>     r = o?.p.q.r()
>
> Results in…
>
>     var o, r;
>     o = {};
>     r = o != null ? o.p.q.r : void 0;
>     r = (o != null ? o.p : void 0).q.r;
>     r = o != null ? o.p.q.r() : void 0;
>
> Non-starter.
>

Yeah, that's the semantics CoffeeScript uses.



> DH: Why not an operator that needs to be explicit?
>
>     o?.p?.q?.r
>
> LH: Why would you ever even use it on the first?
>
> BE: Forget all of the problems with coffeescript's impl, the need exists.
>

OK.


> YK: In the common cases, where it works, it works well. Where it doesn't,
> it falls apart unexpectedly.
>
> WH: What about other contexts such as p?[x], p?.q[x], and p?(x) ? [Note
> that grammar problems arise for some of those.]
>
The grammar can be tweaked seems.


> General agreement.
>
> *Conclusion/Resolution* Seems useful, but not now. Semantics are unclear
>
Yeah, so now, when ES6 is closed, probably the topic can be reiterated
later on for ES7.


> ---
>
> The notes ended a bit too optimistically in my view! "Non-starter".
>
>
Yeah, for ES6 it's pretty optimistically :)

OK, thanks again for clarifying this Brendan, and for putting the notes
here, appreciated.

The only reason I put the topic here, is (not to beat a dead horse of
course), is that we recently had a long internal discussion thread about
it. I first thought, that we could just implement an internal JS extension
for now, and see how it goes (and if it goes well, potentially include it
into ES7), but, true, it needs more clarifications and thoughts.

(still doable though)

Dmitry
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to