News for hackers. Stuff that matters.
Re:Why We Use OCaml by sklogic on Monday November 16, 2015 @06:55PM (#10578232)
Why would you care about selecting the branch in compile time? We're talking about language features semantically equivalent to pattern matching, and, turns out, there are none. As for the importance of the exhaustion check, see the billion-dollar mistake.

Your solution with type and value checks in an if ladder was called "dynamic typing" exactly for this reason - you select paths dynamically in the runtime without any static checks on soundness of this selection.

Re:Why We Use OCaml by dozzie on Tuesday November 17, 2015 @06:08AM (#10580332)
> Why would you care about selecting the branch in compile time?

I wouldn't. Pattern matching is primarly a conditional, that's why I focused on if-else.

> We're talking about language features semantically equivalent to pattern matching, and, turns out, there are none.

Why would you think that pattern matching revolves around compile-time guarantees? It does not. It's primarly a conditional, everything else is an optional, additional effect. You can have pattern matching in dynamically typed languages (Lisp, Erlang).