Re: syntax for case ranges

2020-02-19 Thread Jordan Harband
@kdex (sorry i missed this; your message was in my spam folder) if you find a way that Annex E is non-exhaustive, please file an issue on the spec - I would like it to be exhaustive. On Mon, Feb 3, 2020 at 11:16 AM Naveen Chawla wrote: > Thanks! Although I think it is a value judgement about

Re: syntax for case ranges

2020-02-03 Thread Naveen Chawla
Thanks! Although I think it is a value judgement about how much risk is worth how much reward, and which reward, so I wouldn't classify it as necessarily a complete set of criteria yet, but it is certainly in the right direction. And very interesting to me. Thank you. On Tue, 4 Feb 2020 at 00:40,

Re: syntax for case ranges

2020-02-03 Thread Mark S. Miller
While correct, each case asked the browser makers to make a risky and costly bet. When the risk was low and the payoff high, they've been great at doing so. This one does not fall into the viable risk vs reward territory. On Mon, Feb 3, 2020 at 7:58 AM kdex wrote: > Yes, there have been

Re: syntax for case ranges

2020-02-03 Thread kdex
Yes, there have been numerous backwards-incompatible changes to the language over the years. You can find a list of them in section E of the ECMAScript language standard. IIRC, that list is non-exhaustive. On Monday, February 3, 2020 6:35:12 PM CET Naveen Chawla wrote: > Thank you Claude! I

Re: syntax for case ranges

2020-02-03 Thread Naveen Chawla
Thank you Claude! I did miss the point. Have there ever been "BC" breaks introduced into the language before? If so, is there a sustainable standard for an "acceptable" one? On Mon, 3 Feb 2020 at 22:47, Claude Pache wrote: > Try typing `3 < 2 < 1` in the web console of your favourite

Re: syntax for case ranges

2020-02-03 Thread Isiah Meadows
Does make me wonder if engines should start collecting statistics on how often it's used and how often that result differs from if a Python-style chained comparison was done instead. On Mon, Feb 3, 2020 at 09:18 Claude Pache wrote: > Try typing `3 < 2 < 1` in the web console of your favourite

Re: syntax for case ranges

2020-02-03 Thread Claude Pache
Try typing `3 < 2 < 1` in the web console of your favourite browser, and see the result: it will evaluate to `true`. No, your browser isn’t buggy, it is just following blindly the semantics of `<`. Modifying the meaning of `3 < 2 < 1` in order to make it evaluating to `false` is a BC break.

Re: syntax for case ranges

2020-02-03 Thread Naveen Chawla
Hi! I didn't understand your reply. I think currently it would raise an error, because 1 < 2 < 3 is currently saying (probably) true < 3. But a "new" syntax could possibly parse that as a "chain" of comparisons. Would this be acceptable to introduce into JavaScript (just curious)? I've

Re: syntax for case ranges

2020-02-01 Thread Mark S. Miller
3 < 2 < 1; // true On Sat, Feb 1, 2020 at 3:03 AM Naveen Chawla wrote: > Certain languages allow the expression 0 would be syntactically possible in JavaScript? Of course this would only > apply for "if"/"while" statements. > > On Fri, 31 Jan 2020 at 22:41, Isiah Meadows > wrote: > >> Still

Re: syntax for case ranges

2020-02-01 Thread Naveen Chawla
Certain languages allow the expression 0 wrote: > Still better to discuss it there - it's highly related to your suggestion. > And I'm pretty sure an issue already exists related to that. > > On Fri, Jan 31, 2020 at 09:06 Sultan wrote: > >> The pattern matching proposal does not handles the

Re: syntax for case ranges

2020-01-31 Thread Isiah Meadows
Still better to discuss it there - it's highly related to your suggestion. And I'm pretty sure an issue already exists related to that. On Fri, Jan 31, 2020 at 09:06 Sultan wrote: > The pattern matching proposal does not handles the mentioned case: > > switch(type) { case 0...5: } being the

Re: syntax for case ranges

2020-01-31 Thread Sultan
The pattern matching proposal does not handles the mentioned case: switch(type) { case 0...5: } being the equivalent of switch(type) { case 0: case 1: case 2: case 3: case 4: case 5: } On Fri, Jan 31, 2020 at 7:36 PM Bruno Macabeus wrote: > I agree with Oriol. > We already have the proposal

Re: syntax for case ranges

2020-01-31 Thread Bruno Macabeus
I agree with Oriol. We already have the proposal pattern matching, that has a very similar effect. I think that is better to improve pattern matching proposal in order to be able to match using ranges (or at least check if it's good to do) instead of create a new proposal. On Fri, 31 Jan 2020 at

Re: syntax for case ranges

2020-01-31 Thread Oriol _
This sounds like https://github.com/tc39/proposal-pattern-matching El 31/1/20 a les 10:57, Sultan ha escrit: For example, the following: switch (value) { case 0...9: break case 'a'...'z': break } ___ es-discuss mailing list

Re: syntax for case ranges

2020-01-31 Thread Felipe Nascimento de Moura
Very interesting. Once I wanted (and would have used a lot) something like a `switchMatch`. It would work like this: switchMatch(value) { case /\d+/: { ... } case /\s+/: { ... } case /.../: { ... } default: { console.log('Didn't match any of the options'); } } Of course you can

syntax for case ranges

2020-01-31 Thread Sultan
For example, the following: switch (value) { case 0...9: break case 'a'...'z': break } ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss