3 ms·
Polymorphism that is resolved at run-time, i.e. "virtual" functions is what is specific to OOP. The term "polymorphism" was first used in the documents of the
by adrian_b 3y ago
Polymorphism that is resolved at run-time, i.e. "virtual" functions is what is specific to OOP.
The term "polymorphism" was first used in the documents of the language CPL (in mid sixties), the source of BCPL, where in British English it corresponded to what in the American documents of the same age, starting with McCarthy, were called overloaded operators and overloaded functions.
The use of "polymorphism" mostly for the run-time polymorphism of OOP languages has appeared only a couple of decades later, with Smalltalk.
"Generic", which might be a better term than both, has been popularized during the programming language contest that has lead to Ada (1979). Nowadays it is mostly used for polymorphism/overloading that is resolved at compile time, because this is how the term has been used in Ada.
- ryandv 3y agoEven still, there exist non-OOP implementations of runtime dynamic dispatch, such as Clojure's multimethods.
- ykonstant 3y agoI thought Julia's multiple dispatch was run-time polymorphism?
- mostlylurks 3y agoEven polymorphism that is resolved at run-time is not specific to OOP. In fact, it's used quite extensively outside of OOP, including in both functional and procedural programming. Even ignoring the types of dynamic polymorphism present in other paradigms that might be called "OOP-inspired", there are commonplace patterns such as the use of closures that let you achieve run-time polymorphism and data encapsulation.