TY - GEN
T1 - A Subtyping Scheme for Nominal and Structural Types Based on Class Graph Equivalence
AU - Ke, Wei
AU - Chan, Ka Hou
N1 - Publisher Copyright:
© 2021 ACM.
PY - 2021/12/17
Y1 - 2021/12/17
N2 - Subtyping and multiple inheritance are the essential features of oo and component-based programming languages, in particular with the presence of interfaces and contracts. More general, the composability of these constructs admitting the subtype relation powers the reusability, modular, flexibility and reliability of oo-based systems. While nominal classes allow annotation of user intention to the types, operations on interfaces and contracts naturally result structural constructs. Structural types are also necessary if we need the types to have value-semantics, so that they can be transferred around in distributed systems. Building a type system that allows the coexistence of nominal and structural classes, while maintaining the usual subtype relation is critical and challenging. We present a subtyping scheme that encodes a class to a directed and edge-labeled graph, which has the convenience to handle recursive types. The names of a class and its superclasses are encoded as tags to label the edges of the graph, turning the nominal construct into a structural one. This encoding allows us to unify the handling of class relations into graph relations. We define the class representation, canonical form, value-identity and subtype relation in the notion of graphs, and justify our subtyping scheme in the cases of multiple inheritance, class intersection and union. Our scheme is general, easy to implement and compatible with most of the existing oo type systems, providing a solid base for further oo language and tool development.
AB - Subtyping and multiple inheritance are the essential features of oo and component-based programming languages, in particular with the presence of interfaces and contracts. More general, the composability of these constructs admitting the subtype relation powers the reusability, modular, flexibility and reliability of oo-based systems. While nominal classes allow annotation of user intention to the types, operations on interfaces and contracts naturally result structural constructs. Structural types are also necessary if we need the types to have value-semantics, so that they can be transferred around in distributed systems. Building a type system that allows the coexistence of nominal and structural classes, while maintaining the usual subtype relation is critical and challenging. We present a subtyping scheme that encodes a class to a directed and edge-labeled graph, which has the convenience to handle recursive types. The names of a class and its superclasses are encoded as tags to label the edges of the graph, turning the nominal construct into a structural one. This encoding allows us to unify the handling of class relations into graph relations. We define the class representation, canonical form, value-identity and subtype relation in the notion of graphs, and justify our subtyping scheme in the cases of multiple inheritance, class intersection and union. Our scheme is general, easy to implement and compatible with most of the existing oo type systems, providing a solid base for further oo language and tool development.
KW - class graph
KW - distributed programming
KW - intersection type
KW - multiple inheritance
KW - nominal subtyping
KW - object-oriented language
KW - recursive type
KW - structural subtyping
KW - subtyping
KW - type equivalence
KW - union type
UR - http://www.scopus.com/inward/record.url?scp=85126070499&partnerID=8YFLogxK
U2 - 10.1145/3510487.3510509
DO - 10.1145/3510487.3510509
M3 - Conference contribution
AN - SCOPUS:85126070499
T3 - ACM International Conference Proceeding Series
SP - 151
EP - 157
BT - ICBTA 2021 - 2021 4th International Conference on Blockchain Technology and Applications
PB - Association for Computing Machinery
T2 - 4th International Conference on Blockchain Technology and Applications, ICBTA 2021
Y2 - 17 December 2021 through 19 December 2021
ER -