The obvious benefit of extension methods is that they allow us to append methods to a type *after* it has been defined. But an undervalued advantage is that they append methods to *types*, with all the flexibility Scala gives us to specify those types precisely or generally.
I imagine there would be an unacceptable performance hit if extension methods were considered as potentially higher-priority than class methods for every call, but there might be ways to optimize this.
-
-
I can see the annoyance, though it might be surprising if calling `flatMap` on a value whose type is able to infer an extension method did something different from calling `flatMap` on the same value when its in a generic context and the extension can't be used.
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
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.
