Records are not only difficult to marry with the functional data model. They cause problems even in conventional languages. For example, it is difficult to use records to define an abstract data type Person, as well as subtypes Student and Staff, so that some values can belong to all three sets while certain operations are restricted to values of type Student and others to values of type Staff. Wirth's type extensions[8] come close to allowing this, but fall short because he requires an extended type to be disjoint from the type it is extending. Thus, a record value of type Student, defined as an extension of Person, may be assigned to a variable of type Person, but only with loss of information. Furthermore, a value of type Student cannot also be a value of type Staff.
Problems such as the above also occur when record types are used to model persistent information (databases), and have been discussed at length in [3]. Various solutions have been proposed, including some which are still record based (for example, semantic data models[5]). The ``record free'' functional data model introduced by Shipman[6], however, offers a far simpler solution.
In short, when using the functional data model, one declares groups of functions in the place of records. For example, instead of declaring:
type Person isone declares a group of functions:
record
Name : String;
Date-of-birth : Integer;
end;
P : Person
Name : Person Stringand declares Person to be a set of abstract values, for which no operators exist, apart from explicitly defined functions. Information hiding is achieved by exporting only those functions that are needed by clients.
Date-of-birth : Person Integer
P : {} Person
Note furthermore that it is possible for a client module to define types Staff and Student to be subsets of type Person, and to define additional functions:
Student-number : Student Integer
Staff-number : Staff Integer
Furthermore, if PS denotes a value which is a member of type Staff and type Student, then all of the following function calls are valid:
Name(PS)
Date-of-birth(PS)
Student-number(PS)
Staff-number(PS)
It is very cumbersome to achieve the same functionality using a record-based data model.