The possibility to write
let [a; b] = expr
in #OCaml is cool, but it triggers a “non exhaustive pattern-matching” warning. Which doesn't really make sense since you can only match on one pattern in a “let”.
@orbifx No, indeed. Someone on Stack Overflow recommends adding [@warning "-8"] to the binding, but 1. it's horrible and 2. I can't seem to make it work.
@otini The compiler cannot guess the result of the evaluation of expr.
And fortunately there is no cycling in value assignation like in R.
@otini you can use GADT to prove than the received list has a length of 2 elements.
@dinosaure True! That's what this guy seems to do: https://discuss.ocaml.org/t/non-exhaustive-pattern-matching-warning-in-let-matching/2113/5
@otini you can try-catch that expression for Match_failure, but I don't think it suppresses the warning.