Type extension constructs a new data type from a base data type while retaining a specified relationship with it. In Oberon, a record type can extend another record type by adding fields while preserving its base fields. The language also relates corresponding pointer types and supplies type guards for accessing an extended value.[ref]
The Programming Language Oberon by Niklaus Wirth. §§6.3–6.4, record extension and pointer types; §8.1, type guards
For example, a base
Point can contain coordinates x,y; an extending ColoredPoint retains those coordinates and adds color. Code using a permitted base interface can operate on the inherited coordinates, while access to color requires knowledge of the extension. This is a declared relationship in the type system, rather than an inference that two unrelated record types happen to have similarly named fields. Articles by others on the same topic
There are currently no matching articles.