Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


Share this Page URL
Help

Programming in Scala > Chapter 21: Implicit Conversions and Parameters - Pg. 443

Chapter 21 Implicit Conversions and Parameters There's a fundamental difference between your own code and libraries of other people: you can change or extend your own code as you wish, but if you want to use someone else's libraries, you usually have to take them as they are. A number of constructs have sprung up in programming languages to alleviate this problem. Ruby has modules, and Smalltalk lets packages add to each other's classes. These are very powerful, but also dangerous, in that you modify the behavior of a class for an entire application, some parts of which you might not know. C# 3.0 has static extension methods, which are more local, but also more restrictive in that you can only add methods, not fields, to a class, and you can't make a class implement new interfaces. Scala's answer is implicit conversions and parameters. These can make existing libraries much more pleasant to deal with by letting you leave out