Types

Common ancestor type

A common ancestor type is a type computed for a list of types using the following algorithm:

  1. Add NONE to the list of types (to make sure the list is never empty).
  2. If there is a separate type in the list, add a mark separate in front of all non-separate types in the list.
  3. If there is a detachable type in the list, add a mark detachable in front of all attached types in the list.
  4. If there is a type in the list to which all other types conform, it is the common ancestor type.
  5. Otherwise, add ANY to the list and repeat steps starting from step #2.

Here are some examples:

Type list Common ancestor type
(empty) NONE
BOOLEAN BOOLEAN
BOOLEAN, BOOLEAN BOOLEAN
INTEGER_32, REAL_64, COMPARABLE COMPARABLE
INTEGER_32, REAL_64 ANY
INTEGER_32, detachable COMPARABLE detachable COMPARABLE
INTEGER_32, separate COMPARABLE separate COMPARABLE
detachable STRING, separate COMPARABLE detachable separate COMPARABLE

cached: 11/20/2018 4:18:54.000 PM