Re: Optional Chaining (aka Existential Operator, Null Propagation)

2016-02-04 Thread Claude Pache
> Le 4 févr. 2016 à 21:03, Kevin Smith a écrit : > > > That aside, I have a question about the semantics. What does this do: > > ({ x: 1 }).x?.y.z; > > Does it throw a ReferenceError? > Yes: the `?.` operator does not change the meaning of the subsequent `.`

Re: A promise that resolves after a delay.

2016-02-04 Thread Jan-Ivar Bruaroey
On 2/3/16 11:39 PM, Bob Myers wrote: Promise.resolve(42) . then(wait(1000)) . then( /* cb */); With ES6 I prefer the straightforward: var wait = ms => new Promise(resolve => setTimeout(resolve, ms)); Promise.resolve(42) . then(() => wait(1000)).then(() => { /* cb */ }); Too simple

Re: Optional Chaining (aka Existential Operator, Null Propagation)

2016-02-04 Thread John Lenz
On Wed, Feb 3, 2016 at 2:41 PM, Claude Pache wrote: > > > Le 3 févr. 2016 à 20:56, John Lenz a écrit : > > > > Can you reference something as to why the more obvious operators are > problematic? > > > > ?. > > That one (that I've used) must work,

Re: Optional Chaining (aka Existential Operator, Null Propagation)

2016-02-04 Thread /#!/JoePea
Hello Claude, you prefer `?.` over `.?` as an implementor (I understand what you said about the parsing). But I think as and end user of the syntax, `.?` over `?.` makes more sense as it is easier to distinguish from the ternary operator with a float, as in `x?.3:0` (we know a numerical key can't

Re: Optional Chaining (aka Existential Operator, Null Propagation)

2016-02-04 Thread John Lenz
On Thu, Feb 4, 2016 at 10:06 AM, Claude Pache wrote: > > Le 4 févr. 2016 à 17:47, John Lenz a écrit : > > > [...] > > > Waldemar's example makes the problem obvious but I think we could do use, > which I think is preferable to the proposed: > > .?

Re: Optional Chaining (aka Existential Operator, Null Propagation)

2016-02-04 Thread Claude Pache
> Le 4 févr. 2016 à 17:47, John Lenz a écrit : > > > [...] > > Waldemar's example makes the problem obvious but I think we could do use, > which I think is preferable to the proposed: > > .? > (?) > [?] Yes, that syntax is possible. Whether it is preferable is a

Re: Optional Chaining (aka Existential Operator, Null Propagation)

2016-02-04 Thread Kevin Smith
Thanks for putting this together. At first glance, I think the semantics look pretty good. The syntax still seems problematic, though, from an aesthetic point of view. The `obj ?. prop` form looks natural and aligns well with how this feature appears in other languages. The other forms are