'switch' operator improvement

Brendan Eich brendan at mozilla.org
Tue Oct 16 11:09:43 PDT 2007


On Oct 16, 2007, at 8:19 AM, Dave Herman wrote:

> But that's not what you proposed, is it? I understood your proposal to
> mean something more like:
>
> function f(g) {
>      if (let (tmp = g())    // case g():
>          (tmp is RegEx ? tmp.match(x) : x == tmp)) ....
>      if ....
> }
>
> Dave

Right, and that is not only backward incompatible, but user-hostile  
unless you type everything. It's perl-ish magic.

I say use an if-else and call match if that is what you want. EIBTI,  
the Pythonistas say (Explicit Is Better Than Implicit).

/be




More information about the Es4-discuss mailing list