News for hackers. Stuff that matters.
Re:JavaScript Pattern Matching Proposal by bschwindHN on Wednesday April 25, 2018 @12:17PM (#16923027)
I like it, especially `default` instead of `{}`

The leading curly braces in the linked proposal _are_ a bit odd to see, though the repetition of `case` isn't too fun either.

Re:JavaScript Pattern Matching Proposal by codedokode on Thursday April 26, 2018 @01:57PM (#16934055)
Braces can be used in many cases, but `case` keyword is used only in `switch` and `match` and is not ambigious. You can see what construct it is from the first word.
Re:JavaScript Pattern Matching Proposal by aylmao on Wednesday April 25, 2018 @03:06PM (#16924940)
I suspect the example in the proposal refers to an object that doesn't match any of the previous options, but is still an object.

For a default I'd expect there to be another pattern.

Re:JavaScript Pattern Matching Proposal by edflsafoiewq on Thursday April 26, 2018 @11:02AM (#16932484)
The default pattern is a variable name.

> [About variable name patterns binding to the name] Eliminates the need for an else/default leg, because assignment to any variable will be sufficient. JS programmers are already used to assigning variables that are then ignored (in functions, in particular), and different people have different tastes in what that should be. _, other, etc, would all be perfectly cromulent alternatives.