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

2016-08-25 Thread Claude Pache
> Le 25 août 2016 à 17:17, Claude Pache a écrit : > > >> Le 25 août 2016 à 16:05, Alexander Mekhonoshin > > a écrit : >> >> >> 2. unary ?. >> >> window?.navigator?.toString() >> >> browser: "[object

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

2016-08-25 Thread Claude Pache
> Le 25 août 2016 à 16:05, Alexander Mekhonoshin a > écrit : > > > > 3. groupped ?.() > Syntax for the full existential chain case: > > .?(a.b.c) // equals with typeof a !== 'undefined' && a.b && a.b.c > In other words, `.?(a.b.c)` (or whatever other syntax) is

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

2016-08-25 Thread Claude Pache
> Le 25 août 2016 à 16:05, Alexander Mekhonoshin a > écrit : > > > 2. unary ?. > > window?.navigator?.toString() > > browser: "[object Navigator]" > node: ReferenceError: window is not defined > > here i suggest syntax for exception-slient accesing globals: > > ?.a

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

2016-08-25 Thread Alexander Mekhonoshin
// Excuse my beginner’ English I have a few (3) thoughts: 1. binary ?. If a === null: a?.b.c === undefined If a?.b === null: a?.b.c // throws exception If a?.b === null: a?.b?.c === undefined If a === 0: a?.b.c === undefined If a === '': a?.b.c === undefined If a in not defined: a?.b.c //

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

2016-02-08 Thread Claude Pache
> Le 8 févr. 2016 à 01:16, Bergi a écrit : > > Claude Pache wrote: >> >>> .? >>> (?) >>> [?] >> >> Yes, that syntax is possible. Whether it is preferable is a question of >> taste. Personally, I don’t like it: >> >> * I slightly prefer `?.` over `.?` for the following

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

2016-02-08 Thread Claude Pache
> Le 8 févr. 2016 à 19:58, John Lenz a écrit : > > If we ever hope to include "elvis". > > obj?:[expr] > > would be roughly equivalent to: > > obj != null ? obj : [expr] > > rather than what you are suggesting here: > > obj != null ? obj[expr] : undefined; We can

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

2016-02-08 Thread John Lenz
If we ever hope to include "elvis". obj?:[expr] would be roughly equivalent to: obj != null ? obj : [expr] rather than what you are suggesting here: obj != null ? obj[expr] : undefined; On Sun, Feb 7, 2016 at 4:16 PM, Bergi wrote: > Claude Pache wrote: > >> >> .? >>> (?)

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

2016-02-07 Thread Bergi
Claude Pache wrote: .? (?) [?] Yes, that syntax is possible. Whether it is preferable is a question of taste. Personally, I don’t like it: * I slightly prefer `?.` over `.?` for the following reason: The `?.` token may be conceptually separated in two, first the question mark which checks

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

2016-02-05 Thread Kevin Smith
> > Yes: the `?.` operator does not change the meaning of the subsequent `.` > operator. I like to think of it as: the effect is local (short-circuiting > aside), you are not switching between "modes". It’s a feature. > Just curious: what's the rationale for that behavior, as opposed to "deep"

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

2016-02-05 Thread Mat At Bread
the person managing the list at es-discuss-ow...@mozilla.org When replying, please edit your Subject line so it is more specific than "Re: Contents of es-discuss digest..." -- Today's Topics: 1. Re: Optional Chaining (aka Existential Operator, Null Propagation)

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

2016-02-05 Thread Claude Pache
> Le 5 févr. 2016 à 16:22, Kevin Smith a écrit : > > Yes: the `?.` operator does not change the meaning of the subsequent `.` > operator. I like to think of it as: the effect is local (short-circuiting > aside), you are not switching between "modes". It’s a feature. > >

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

2016-02-05 Thread Kevin Smith
> > In case `myForm.querySelector('select[name=foo]')` is not null, then > `myForm.querySelector('select[name=foo]').selectedOptions` is always an > HTMLCollection and has always a `length` property. If it is not the case, > then either I made a typo, or I am testing some ancient browser that >

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

2016-02-05 Thread Claude Pache
> Le 4 févr. 2016 à 21:03, Kevin Smith a écrit : > > (...) 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

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: 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

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

2016-02-03 Thread Waldemar Horwat
On 02/03/2016 11:56, John Lenz wrote: Can you reference something as to why the more obvious operators are problematic? ?. ?[] ?() ?: Some of these have problems. For example, a?[]:b is already valid ECMAScript syntax and does something else. There is an analogous but subtler problem for

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

2016-02-03 Thread Claude Pache
> 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, with the simple lookahead I've put in the lexical grammar, in order to continue to parse

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

2016-02-03 Thread John Lenz
Can you reference something as to why the more obvious operators are problematic? ?. ?[] ?() ?: On Fri, Jan 29, 2016 at 7:19 AM, Claude Pache wrote: > Hi, > > I have prepared a strawman for the `?.` operator: > > https://github.com/claudepache/es-optional-chaining/ > >