Language Reference/Basic Concepts/Types and Subtypes
Types
Visual Prolog types are divided into object types and value types. Objects have mutable state, whereas values are immutable.
Object types are defined by interface definitions.
The value types include numerical types, strings, character types, and compound domains (also known as algebraic data types). Simpler forms of compound domains are structure and enumeration types, whereas more complex forms represent tree structures.
Subtypes
Types are organized in a subtype hierarchy. Subtypes provide subsumption polymorphism: any context that expects a value of some type will also accept a value of any subtype. Equivalently, values of a given type are implicitly converted to any super-type where needed; no explicit cast is required.
Subtypes can be derived from any value type, except from algebraic data types. Types derived from algebraic data types are synonym types rather than subtypes (i.e., they denote the same type).
The notion of subtypes relates to the notion of subsets. However, even if a type is "mathematically" a subset of another type, it is not a subtype unless declared as such.
domains t1 = [1..17]. t2 = [5..13]. t3 = t1 [5..13].
t1 is an integral type whose values are the integers from 1 to 17 (inclusive). Likewise, t2 contains the values from 5 to 13. So t2 is a subset of t1, but t2 is not a subtype of t1. By contrast, t3 (which contains the same values as t2) is a subtype of t1, because it is declared to be so.
The language contains a few implicit subtype relations; otherwise, subtype relations are stated explicitly in type definitions.
Object types are organized in a subtype hierarchy rooted in the predefined object type object, i.e., any object type is a subtype of object. Object subtypes are formed by stating that one interface supports another. If an object has an interface/object type that supports another interface, the object also has that type and can be used as such without further changes.
See also: Universal and Root Types