{'fraction_non_alphanumeric': 0.022408963585434174, 'fraction_numerical': 0.0, 'mean_word_length': 5.677570093457944, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Graph interpretation of methods: a unifying framework for polymorphism in object-oriented programming

We discuss two interpretations of methods and classes in object-oriented programming and demonstrate a type system based on the notion of methods as graphs. Definitionally, a class may be viewed as a data structure associated with either a collection of method interfaces or a collection of individual methods. In the former interpretation, a method represents a collection of functions that satisfy its interface known as a function space. In the latter interpretation, a method represents a set of input-output pairs of a specific function, called the function's graph. We informally describe and contrast these interpretations with particular emphasis on subtyping rules for methods --- an anti-monotonic rule for the function space interpretation and a monotonic rule for the graph interpretation. These rules have practical implications on type checking, method redefinition, assertions, dynamic binding, and completeness of subtype testing. We present a notation based on the latter interpretation and demonstrate several interesting features of our notation including abstract data types for encapsulation, four kinds of ad-hoc polymorphism (disjoint overloading, coercion, incremental overloading, and specialization), and type restrictions to precisely define the relationship among arguments in polymorphic methods.