Re: Re: Existential Operator / Null Propagation Operator

2016-10-13 Thread Kagami Rosylight
>From a technical point of view, using ![ instead of ?.[ may work only if you >forbid a line terminator before the ! I tried this on [TS Playground](http://www.typescriptlang.org/play/#src=var%20a%20%3D%20%7B%7D%3B%0D%0A%0D%0Aa!%5B3%5D%3B%0D%0Aa%0D%0A!%5B3%5D%3B) and it interestingly changes

Re: Existential Operator / Null Propagation Operator

2016-10-13 Thread Isiah Meadows
On Thu, Oct 13, 2016, 12:07 Claude Pache wrote: Le 13 oct. 2016 à 17:14, Kagami Rosylight a écrit : >IIRC the proposed syntax for computed properties was x?.[y], Yes you’re right, sorry :/ IMO it still seems the syntax problem is the main

Re: Existential Operator / Null Propagation Operator

2016-10-13 Thread Claude Pache
> Le 13 oct. 2016 à 19:20, Bob Myers a écrit : > > Why is this needed? Why are people trying to get the property of an object > which is null? Why is the object null in the first place? This is not about trying to get something from null, but about taking different paths

Re: Existential Operator / Null Propagation Operator

2016-10-13 Thread Mark Volkmann
I think the point is that people would like to write something like this: if (person?.address?.zipcode) instead of this: if (person && person.address && person.address.zipcode) That appeals to me. On Thu, Oct 13, 2016 at 12:20 PM, Bob Myers wrote: > Why is this needed? Why are

Re: Re: Existential Operator / Null Propagation Operator

2016-10-13 Thread Kagami Rosylight
>Why is this needed? Why are people trying to get the property of an object >which is null? I will appreciate null propagation when a function receives an “option bag” ```js function someFunction(options) { if(options?.foo) { doSomething(); }; } someFunction(); someFunction({ foo: true

Re: Existential Operator / Null Propagation Operator

2016-10-13 Thread Bob Myers
Why is this needed? Why are people trying to get the property of an object which is null? Why is the object null in the first place? This can probably be considered poor program design. It's sort of like trying to dereference a null pointer. In addition, parameter defaults and defaults in

Re: Existential Operator / Null Propagation Operator

2016-10-13 Thread Claude Pache
> Le 13 oct. 2016 à 17:32, Isiah Meadows a écrit : > > It may be a good idea to create a pull request for it if it isn't listed yet > I've already tried some time ago: https://github.com/tc39/ecma262/pull/340 —Claude___

Re: Existential Operator / Null Propagation Operator

2016-10-13 Thread Claude Pache
> Le 13 oct. 2016 à 17:14, Kagami Rosylight a écrit : > > > >IIRC the proposed syntax for computed properties was x?.[y], > > Yes you’re right, sorry :/ > > IMO it still seems the syntax problem is the main reason why this proposal > has stalled. If not, what is

Re: Re: Existential Operator / Null Propagation Operator

2016-10-13 Thread Isiah Meadows
It may be a good idea to create a pull request for it if it isn't listed yet (search "null propagation JavaScript"). I know there's a proposal written out (I've seen it), I just don't recall the exact URL offhand nor if there's a champion or not, but I thought it did. It could be one of those

Re: Re: Existential Operator / Null Propagation Operator

2016-10-13 Thread Kagami Rosylight
>IIRC the proposed syntax for computed properties was x?.[y], Yes you’re right, sorry :/ IMO it still seems the syntax problem is the main reason why this proposal has stalled. If not, what is the problem here? I’m curious why this proposal is not even listed in stage 0 proposal list.

Re: Re: Existential Operator / Null Propagation Operator

2016-10-13 Thread Isiah Meadows
IIRC the proposed syntax for computed properties was `x?.[y]`, to avoid the ambiguity. On Thu, Oct 13, 2016, 10:24 Kagami Rosylight wrote: > > > >The token ?. works fine > > > > I think more than half of this thread is about syntactic ambiguity, > regardless of whether

Re: Re: Existential Operator / Null Propagation Operator

2016-10-13 Thread Kagami Rosylight
>The token ?. works fine I think more than half of this thread is about syntactic ambiguity, regardless of whether the ambiguity is real or not. For example, from [an earlier post of this thread](https://esdiscuss.org/topic/existential-operator-null-propagation-operator#content-44): >But

Re: Existential Operator / Null Propagation Operator

2016-10-13 Thread Claude Pache
> Le 13 oct. 2016 à 14:37, Kagami Rosylight a écrit : > > > Or `!.`, which unfortunately is now being used by TypeScript? What is exactly the issue you're trying to solve? The token `?.` works fine (technically with a simple lookahead for excluding digit after it).

Re: Re: Existential Operator / Null Propagation Operator

2016-10-13 Thread Isiah Meadows
TypeScript can change if it has to, and it's done so before (ES modules are a good example of this). They try their best to be a strict superset of ECMAScript, and this even goes as far as making type errors early warnings, not early errors, by default (the latter would technically be a violation

Re: Re: Existential Operator / Null Propagation Operator

2016-10-13 Thread Kagami Rosylight
Or `!.`, which unfortunately is now being used by TypeScript? ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss