News for hackers. Stuff that matters.
Re:Value-Oriented Programming by naasking on Friday August 31, 2018 @04:46PM (#17888527)
Subtyping describes an abstraction with which you can substitute any implementation that conforms to that abstraction's signature (Liskov substitution). Subclassing instead typically imposes both subtyping and behavioural inheritance. So as a rough approximation:

Interface implementation = subtyping

Class inheritance = subclassing + subtyping, ie. inheriting behaviour + subtyping

An OO language where you were forced to specify subtyping by implementing interfaces, but you could separately declare some implementations you inherited from without that also applying a subtyping relationship with those types, then that would be a proper separation of concerns.

Oleg discusses the issues in further detail here: http://okmij.org/ftp/Computation/Subtyping/

There are no comments on this comment yet.