HANDBOOK / GENTLE PRIMER / Using Types and Predicates Written in C /

# External Types

An external type, i.e. a type whose values are not defined in Gentle, may be introduced by a type declaration without functor definitions.

By way of example, consider the declaration

       'type' IDENT

which introduces an external type `IDENT`.

Since in Gentle the values of this type are not specified they cannot be denoted by terms. On the other hand, values of an external type such as `IDENT` can be used in the same way as values of other types: they can appear as parameters of predicates and may be used as constituents of terms.

We could, for example, define a new type that introduces lists of `IDENT`s:

       'type' IDENTLIST
          list (IDENT, IDENTLIST)
          nil

and pass values of type `IDENT` as parameters as in

       'action' DeclareIdentList(IDENTLIST, TYPE)

       'rule' DeclareIdentList(list(Ident, IdentList), Type):
          DeclareIdent(Ident, Type)
          DeclareIdentList(IdentList, Type)

       'rule' DeclareIdentList(nil, Type)