For example, we can extend `Seq[String]` with new methods while having no bearing on `Seq`s of other types. Or we can append methods to `Product & Serializable`s, regardless of the actual class or trait that implements `Product` and `Serializable`.
-
-
Show this threadThanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
You're right, except when it doesn't work. One common gotcha is that class methods have a higher priority than extension methods. And we can't specify priorities for extensions defined by 2 different parties.
-
E.g. if you define an opaque type + flatMap is very different from a class + a flatMap method. The later can specify a flatMap method with a more flexible signature than Monad.flatMap, whereas the former cannot do it. Kind of pisses me off

- Show replies
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.