Open and closed union types in Ocaml
问题 I'm looking into OCaml for the first time, having a bit of background with F# and Haskell. As such, a lot is familiar-looking, but one thing that isn't is the concept of "open" and "closed" unions (with the backtick and [< syntax). What are these useful for and how often are they used? 回答1: gasche's answer has good advice. I'm going to explain open and closed unions a bit more. First, you need to distinguish the two kinds of unions: basic variants (no backtick) and polymorphic variants (with