HiLang definition Inheritance
| Definition | Name |
Elements can “inherit” from other elements, the definition will be expanded during generation so that the concrete element includes all the keys, values, and extensions of the base type. Inheritance is especially useful for ensuring that all concrete elements have the same shape as a base type.
Inheritance is a useful mechanism to provide properties, keys, values and views to an element. Prelude provides useful addin types to apply patterns via base types
/* helper type to add Versioned attribute and Deleted value */
@Versioned type Versioned { "Flag for read horizon filter to hide when true" Deleted = false };
@Versioned
type HasVectorSpace
[
VectorSpace : Hiperspace.VectorSpace
];
The definition entity Customer : Versioned
adds both the @Versioned
property and the Deleted
flag. 'entity Location : HasVectorSpaceadds the aspect
VectorSpace` to an entity that need geospatial or AI search.
The RBAC.hilang example highlights inheritance of Keys, Values and Extension properties
The user entity Access.RBAC.User : Access.RBAC.Principal
inherits from type Access.RBAC.Principal : Versioned, Access.RBAC.Permissioned
which in turn inherits from type Access.RBAC.Permissioned
. The generated code includes all the keys, values, extents, views and properties of the base types.