JavaScript Pattern Matching Proposal
So the proposal is super confusing to me (but I hadn&#x27;t seen match before). At first I thought it had something to do with regex.<p>Essentially it&#x27;s a switch variant that is (a) confusingly named &#x27;match&#x27; (bad) (b) returns a value (good?) (c) and is actually a kind of function (wha?), since it (d) supports recursion, but (e) doesn&#x27;t require break (good), (f) looks like a bag of inline functions but isn&#x27;t (bad).<p>How about provide a replacement for switch, with a name that isn&#x27;t confusing that doesn&#x27;t require break but otherwise has switch semantics, isn&#x27;t recursive (we have a mechanism for that) and has the matching behavior suggested? Assuming we stick with &#x27;match&#x27; it would look like:<p>foo = match(x) { 
 case {y: 1} : &#x2F;* result if x.y === 1 *&#x2F;;
 ...
}<p>Seems far less confusing.