One of the most self-aware learnings to come out of OOP is "favor composition over inheritance". Even in OOP, inheritance is an anti-pattern. All roads lead to FP.
-
-
With inheritance, the methods defined by DigestibleOfMarshalable could be imported directly, and if I wanted to override them it wouldn't be as problematic.
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
what about (shortened) ``` class type ['a] marshalable = object method marshal : ... end class ['a] digestibleOfMarshalable = object(self : # marshalable) method digest = ... end class ['a] foo = object method marshal = ... inherit [_] digestibleOfMarshalable end ``` ?
-
Thanks for the suggestion. I'm not familiar enough with OCaml's object system to comment, but I'll experiment with it. That said, inasmuch as it works (multiple inheritance?), it's precisely an example of using inheritance to simplify something that is a huge pain with FP\OOP.
End of conversation
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.
Read my blog!