Hacker News new | ask | show | jobs
by d--b 2985 days ago
Javascript is such a mess, this proposal looks really bad, and the guys discussing it are saying things like: "we should make sure that this doesn't look like anything else, so that people who learn the language don't confuse match and switch..."

There is also a lot of "we shouldn't break that" messages, and people reply with "oh we already screwed that up here and there, so it's fine"...

3 comments

It looks pretty much exactly like the Rust match, though.

https://doc.rust-lang.org/stable/book/second-edition/ch06-02...

I don't understand what all the fuss is about. Just looking at the syntax examples given, it looks really nice and I would jump at the opportunity to use it.
as someone who only has a little experience with pattern matching, how does this look bad? The syntax looks good enough to me that I could and would want to use it.
“looking bad” is a really subjective thing.

Here is the syntax for different languages:

- Rust https://doc.rust-lang.org/stable/book/second-edition/ch06-02...

- Haskell http://learnyouahaskell.com/syntax-in-functions

- Scala https://docs.scala-lang.org/tour/pattern-matching.html