3 ms·
I would prefer `match { ... } (value)`, with the `match` keyword essentially creating a function that does the matching when it invoked. Minor seeming change, b
by mattbierner 8y ago
I would prefer `match { ... } (value)`, with the `match` keyword essentially creating a function that does the matching when it invoked. Minor seeming change, but then you can think of match as being a generalization of arrow functions instead of a special new language construct (i.e., `(...args) => ...` is just shorthand for `match { ...args => ... }`)
I can understand why though they went with similar syntax to a switch statement though
- edflsafoiewq 8y agoThis wouldn't work if the match contained eg. break or return.
- mattbierner 8y agoYes, if match is an expression than this restriction is the correct design in my opinion
- abecedarius 8y agoThis might be too cute, but you could support both unambiguously: match (subject) { ... } and match { ... }.