Two reasons type classes are superior to OOP-style interfaces: 1. You can define instances for 3rd party data types 2. You can use the same data but different logic Type classes decouple capabilities from both types and data, giving you increased flexibility and power.
-
-
Replying to @jdegoes
You can translate automatically between OOP and typeclasses. The main difference, where typeclasses are superior, is that with them constructors are first-class functions, instead of meta-level protocol entities ("new"). See http://github.com/fare/lil-ilc2012 ….
2 replies 1 retweet 5 likes -
Replying to @Ngnghm
Arguments about hypothetical tools that don’t exist aren’t very persuasive to me. The non-local reasoning (practically) required by inheritance is real and detrimental to large OOP code base I’ve worked on.
1 reply 0 retweets 1 like
Hypothetical? Those tools exist, at least for Common Lisp. To achieve equivalent functionality without inheritance, I am composing a large number of higher order modules, and using module and signature inclusion. This is just as "non local", but only sucks in comparison.
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!