https://www.seas.harvard.edu/courses/cs152/2015sp/lectures/lec14-polymorphism.pdf
subtype and parametric polymorphism: we discuss the subtype relations that can exist between instantiations of parameterized types and which of those
Defining the polymorphic subtyping relation and defining a polymorphic calculus are distinct problems (though the latter depends on the former) and there is no.
Abstract. All object-oriented languages provide support for subtype polymorphism which allows the writing of generic code.
We study subtype checking for recursive types in system kernel Fun a typed ?- calculus with subtyping and bounded second-order polymorphism.
https://www.seas.harvard.edu/courses/cs152/2010sp/lectures/lec17.pdf
We describe a logic for a program- ming language with parametric polymorphism and sub- typing. The logic supports the formal definition and use of relational
parametric polymorphism allowing for types as parameters subtype and parametric polymorphism: ... mechanisms for subtype polymorphism
https://www.seas.harvard.edu/courses/cs152/2016sp/lectures/lec15-polymorphism.pdf
Subtype polymorphism. • What we discussed… Code can use a subclass B where a superclass A is expected. • E.g. code A a; … a.m() is “polymorphic”
Parametric polymorphism Polymorphmeans “many forms” Polymorphismis the ability of code to be used on values of different types For example a polymorphic function is one that can be invoked with arguments of different types Apolymorphic datatype is one that can contain elements of different types
•Subtype polymorphism requires declared types for seq1 and seq2 which are iterabletypes •Subtype polymorphism guarantees that every subclass of the declared type will be iterable! •Java subtyping guarantees that when intersect is called the runtime seq1 and seq2 will implement iteration! •With subtype polymorphism the compiler
Polymorphismis the ability of code to be usedon values of di erent types E g a polymorphic function is one that can beinvoked with arguments of di erent types A polymorphic datatype is one that can containelements of di erent types Subtype polymorphism Gives a single term many types using thesubsumption rule
In this paper we study the interaction of subtyp- ing and parametricity A polymorphic function may be said to be parametric in Strachey’s sense [Str67 Rey83 PA93] if it can be given by a uniform algo- rithm or program independently of the type of its arguments
•The implementation of a parametric polymorphic interface cannot depend on the type parameter –the implementation of enqcan only invoke methods on ‘o’ that are inherited from Object –i e the onlything we know about E is that it is a subtype of Object Parametric Polymorphism (a k a Generics)
Then T is the type of objects contained in the set (the notation indicates a so-called "type parameter", which is what makes it parametric polymorphism). In subtype polymorphism, you can reuse sets only with objects whose types are subtypes of a particular type.
A polymorphic type is one whose operations can also be applied to values of some other type, or types. There are several fundamentally different kinds of polymorphism: Ad hoc polymorphism: when a function denotes different and potentially heterogeneous implementations depending on a limited range of individually specified types and combinations.
Java supports parametric polymorphism via generics, which I'll discuss in a future article. Subtype means that a type can serve as another type's subtype. When a subtype instance appears in a supertype context, executing a supertype operation on the subtype instance results in the subtype's version of that operation executing.
Polymorphism does not require subtyping. It is the concept of object oriented programming.The ability of different objects to respond, each in its own way, to identical messages is called polymorphism. Polymorphism results from the fact that every class lives in its own namespace.