Re:Try OCaml
by mirekrusin on Friday September 07, 2018 @07:38AM
(#17933466)
No and that’s one of biggest problems, pattern match is runtime decision not compile time one. It’s a shame because pattern matching with algebraic types is the full picture of the whole thing. Without it it’s just one-legged weirdo. It would be possible to emit runtime checks, similar to how tcomb+flow does it, but that’s not gonna happen anytime soon.
[ Parent
| on HN ]
Re:Try OCaml
by pseudonom- on Friday September 07, 2018 @11:45AM
(#17935184)
You can use switch statements for a pattern matching analogue. See the "Exhaustiveness Checking" heading at https://www.typescriptlang.org/docs/handbook/advanced-types.....