Re:Try OCaml
by k__ on Friday September 07, 2018 @09:52AM
(#17934202)
Isn't one part of pattern matching to ask for a type and the other to ask which values the (instance?) of that type holds?
[ Parent
| on HN ]
When a language has algebraic data types -- i.e., data types that have multiple, disjoint constructors -- pattern matching generally means determining which constructor was used to create the value being matched, and branching on that. I'm guessing this is the kind of pattern-match that TypeScript users would be eager to have.
What I don't see is how this requires the addition of a "runtime" on top of the JS model to make it work. I don't use TypeScript, and don't know how it implements its data types, so there may be something obvious here that I'm missing.