Hacker News new | ask | show | jobs
by cevn 2982 days ago
That would be really cool. This match feels a lot like Rust's which is good.
1 comments

I would argue that it doesn't feel like JavaScript much which seems bad.
Why? To me it seems pretty aligned with the "feel" of destructuring.
In my mind there are several valid options out there now:

1. Regex style: new match(input, options);

or built in function match(foo, bar);

or like switch match (foo){ cases

}

But, to have the switch statement syntax and return a value seems like a less than good way to implement this.

I'd argue they've already started going down the "doesn't feel much like JavaScript" road when they started introducing things like fat arrows. I agree that it is bad.
Along with the class syntax (however convenient, JS is not a class-based language).

Aren't decorators also in the works?