On 8/16/12 1:33 PM, David Rajchenbach-Teller wrote:
fwiw, OCaml does
match myfoo with
| #bar -> (*any item of sum type bar*)
| `bar -> (*sum constructor `bar*)
| bar -> (*binding*)
It works nicely in practice.
But OCaml uses capitalization for sum types, like Haskell does.
Also Niko points out that we can make a warning if you mention a variant
in a pattern that would ordinarily be part of the type, but that variant
wasn't imported. (For example: if you mention None in a pattern matching
over option types, but None wasn't imported, you'd get a warning. Of
course None gets imported by default, so this wouldn't actually occur.)
Patrick
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev