3 ms·
I'm new to Scala, but I love their alternative with the colorful name "Pimp My Library": http://scala.sygneca.com/patterns/pimp-my-library http://scala.sygneca.
by snprbob86 16y ago
I'm new to Scala, but I love their alternative with the colorful name "Pimp My Library": http://scala.sygneca.com/patterns/pimp-my-library http://scala.sygneca.com/patterns/pimp-my-library
In summary, you mark a method as "implicit" which constructors a decorator object with your extension methods. Implicits must be explicitly brought into scope and any ambiguities are a compile time error. This model is much more robust than Ruby's, but owes a lot of it's error-prevention to clever use of static typing.