4 ms·
Coercion is not a form of polymorphism. In all the other forms, dispatch depends on the type of a value. When there's coercion going on, be it explicit or impli
by seliopou 16y ago
Coercion is not a form of polymorphism. In all the other forms, dispatch depends on the type of a value. When there's coercion going on, be it explicit or implicit, the same code is being executed regardless of the value being coerced. The only code that one might say "changes" is any code that's executed to perform the cast. But that change in casting is basically ad-hoc polymorphism.
- pkrumins 16y agoThis paper [1] says coercion is a kind of ad-hoc polymorphism. [1] "On Understanding Types, Data Abstraction, and Polymorphism" http://lucacardelli.name/Papers/OnUnderstanding.A4.pdf http://lucacardelli.name/Papers/OnUnderstanding.A4.pdf