One source that explains how record labels are disambiguated is: https://realworldocaml.org/v1/en/html/records.html#reusing-field-names. Parenthetically, it seems to me that your question is hardly related to the subject of this thread, so it may have been better to start a new thread in this case, than to piggy-back onto an existing thread. -- Best, Evgeny ("Zhenya") On Fri, Feb 2, 2018 at 3:07 PM, Toby Kelsey wrote: > On 24/01/18 08:43, Jacques Garrigue wrote: > >> I.e., types can be used to optimize a program, but they do not change its >> semantics. >> It’s true of so-called “overloaded” record labels, it’s true of a labeled >> and default arguments >> (which use type information for compilation, but not semantics), it’s >> true of objects, >> it’s true of GADT pattern-matching (again optimized), etc… >> > > type foo = { x : int } > type bar = { x : string } > > let f r = r.x (* OK: uses bar *) > let f r = (r:foo).x (* OK: uses foo *) > let f r = (r.x : int) (* type error - wrong type inferred *) > > > Aren't the semantics different? 'f' has different types in the first two > definitions, And why does type inference fail for the last example? > > Toby > > > -- > Caml-list mailing list. Subscription management and archives: > https://sympa.inria.fr/sympa/arc/caml-list > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs >