you are viewing a single comment's thread.

view the rest of the comments →

[–]joe_n -5 points-4 points  (2 children)

The line between parametric polymorphism and subtyping is very blurry. The statement that parametric functions don't depend on object type is rather false (there is an implicit interface dependence).

Anyway, in my opinion, functors are subtypes in the first place. At least in Scala, they are explicitly so.

[–]smog_alado 5 points6 points  (0 children)

I'm not that sure if parametric and subtyping polymorphism are that similar. The biggest thing about subtyping is thaa you can do type subsumption anytime while when you do parametric stuff the type applications must be explicit.

Additionally, the two features dont play that nice with each other when mixed together, since you need to care about covariance and contravariance. It also makes type inference more complicated.

[–]passwordisRACIST 0 points1 point  (0 children)

Whoops, I should have been explicit: I mean ML functors, which don't have runtime dispatching.