Are OCaml records structurally typed or nominally typed?

I don’t know what you mean by “nominally”, but a record-declaration declares these new field-names. Do it again (the identical declaration), and you redeclare the field-names. The new declarations obscure (or “shadow”) the old ones. But code or data that was created using the first declaration will necessarily be incompatible with the type of the second declaration.

2 Likes