We've used record types in several places in the book so far, mostly to build a person type with an ID and a name. Let's examine this simple record type a bit more closely and pick apart what exactly happens when it is created:
type person = {id: int, name: string};
As a whole, this type definition creates a new nominal type called person with two named fields: id and name, with specific int and string types. A nominal type is one that is distinguished by the typechecker from other types solely by name.
This is as opposed to structural types, which are considered by the typechecker to be equal to their constituent types. For example, we saw in the previous chapter that modules are structurally typed. We'll see some more examples in this chapter and the next one.
At any rate, nominal types cannot be used interchangeably, even if they have the exact same...