Some early-morning thoughts on Fortress Skype chat
These came as a result of reading through Cardelli and Wegner. On understanding types, data abstraction, and polymorphism. (1985) and Cook. On Understanding Data Abstraction, Revisited. (2009).
I’m starting to realize how much we are blending the notions of ADTs and objects by virtue of functional methods
What Cardelli and Wegner call “inclusion polymorphism,” that gotten from object subtyping/inheritance, becomes entirely a matter of overloading for us, making it more “ad-hoc polymorphism”
They classified polymorphism into two major categories: universal (parametric and inclusion) and ad-hoc (overloading and coercion)
The difference in ad-hoc polymorphism between Fortress (objects/traits) and Haskell (type classes) is a matter of structural representation, in the sense that we impose structural similarities on the operands of polymorphic functions (i.e. subtype relation between receiver types of inherited functional methods) whereas Haskell type classes impose no such restriction (each overloading definition is defined individually, or classified in universally quantified groups)
If objects are concerned with descriptions of behaviors and abstract data types are concerned with hidden representations, then we are already blending the two by virtue of dynamic dispatch, since operations can be overloaded for each representation
Of course, we are still stuck with the binary method problem, since in these terms our operations on representations are confined to those with only a single operand of that type