6 Field Types

Field values are, by default, unrestricted text strings. However, it is often useful to impose some restrictions on the values of certain fields. For example, consider the following record:

Id: 111
Name: Jose E. Marchesi
Age: 30
MaritalStatus: single
Phone: +49 666 666 66

The values of the fields must clearly follow some structure in order to make sense. Id is a numeric identifier for a person. Name will never use several lines. Age will typically be in the range 0..120, and there are only a few valid values for MaritalStatus: single, married, divorced, and widow(er). Phones may be restricted to some standard format as well to be valid. All these restrictions (and many others) can be enforced by using field types.

There are two kind of field types: anonymous and named. Those are described in the following subsections.