Eric Elliott (2014-02-20T20:20:54.000Z)
Object literals are already a great alternative to switch in JS:

var cases = {
  val1:  function () {},
  val2: function () {}
};

cases[val]();

Fall through is more trouble than it's worth, IMO.
On Feb 17, 2014 1:44 PM, "Giacomo Cau" <cau.giacomo190 at tiscali.it> wrote:

>   -----Messaggio originale-----
> From: Brendan Eich
> Sent: Wednesday, February 12, 2014 2:00 AM
> To: Nathan Wall
> Cc: Giacomo Cau ; es-discuss at mozilla.org
> Subject: Re: Another switch
>
> Definitely good to see new languages being designed and implemented.
>
> JS is not going to break compatibility on the old fall-through behavior
> of switch, inherited from Java from C++ from C. All the C-like languages
> copy this flaw, because to do otherwise with the same keyword would be
> worse (confused users cross-training and -coding among languages would
> want our scalps), and IMHO using novel reserved words would be hardly
> better.
>
> /be
> > Nathan Wall <mailto:nathan.wall at live.com>
> > February 11, 2014 at 3:21 PM
> > Hi Giacomo,
> >
> > Not sure whether this will be of interest to you, but I have been
> > working on a JS-derived language called Proto (still highly
> > experimental) which has a switch statement that works exactly as you
> > described:
> >
> > https://github.com/Nathan-Wall/proto/blob/master/docs/control/switch.md
> >
> > Perhaps you will at least find it interesting. :)
> >
> > Nathan
> >
>
> yes, so great it would be a pleasure to contribute :)
>
> the proposal doesn't want, by no means, to break the compability with the
> present syntax and/or semantics of the switch.
> At most, should be considered as an extension of current syntax with a
> consequential new semantics.
>
> the swith, as it is known, should anyhow be written as
>
> switch (...) {
>     case ...: ...; break;
>     case ...: ...; break;
>     case ...: ...;
>     case ...: ...; break;
>     otherwise: ...
> }
>
> but, it could be handy to write the same thing with a slightly different
> syntax:
>
> switch (...) break {
>     case ...: ...;
>     case ...: ...;
>     case ...: ...; continue;
>     case ...: ...;
>     otherwise: ...
> }
>
> Some break less, no new keyword, no incompatibility with past.
> Who shall use it, will know from the start that here, the continue will
> not lead him at the beginning of the first for or while that englobe the
> switch, but only at the following case.
>
>
> Then, willingly, we could also think that normal switch be desugared in
>
> switch (...) continue {
>     case ...: ...; break;
>     case ...: ...; break;
>     case ...: ...;
>     case ...: ...; break;
>     otherwise: ...
> }
>
> with break and continue (except that between ')' and '{' ) that,
> obviously, continue as before.
> This isn't a must, it's just for my pleasure in finding regularity.
>
>
> At last, if we were to look for the burden of a new keyword, even better
>
> select (...) {
>     case ...: ...;
>     case ...: ...;
>     case ...: ...; continue;
>     case ...: ...;
>     otherwise: ...
> }
>
> but I realize this could be a break point of the existing code and,
> onestly speaking, it is beyond my ability to evaluate.
>
>
> Anyhow, thanks for your attention.
>
>
> bye
>
>     Giacomo Cau
>
>
>
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20140220/bfc03457/attachment.html>
domenic at domenicdenicola.com (2014-02-24T21:29:22.755Z)
Object literals are already a great alternative to switch in JS:

```js
var cases = {
  val1:  function () {},
  val2: function () {}
};

cases[val]();
```

Fall through is more trouble than it's worth, IMO.