4 ms·
Pattern matching doesn't require any kind of runtime support, and can be implemented through desugaring.
by wtetzner 8y ago
Pattern matching doesn't require any kind of runtime support, and can be implemented through desugaring.
- k__ 8y agoHow so?
- jaaames 8y agoI believe there was/is a stage 0 proposal for pattern matching in ECMAScript
- k__ 8y agoStage 1 and yes, this one simply uses destructuring. But it could use JavaScripts own types. But it couldn't use TypeScripts types.
- wtetzner 8y agoWhy would it need runtime support? It would just desugar into an if-else chain.