Scala 2.10 string interpolation January 23, 2013
A new feature in Scala 2.10 is string interpolation. The idea is that anytime the compiler finds a literal of the form id"some string", it transforms it to a method call on an instance of StringContext. Scala 2.10 defines 3 methods for this use: s, f, raw. You can see basic use of each bellow:
Nice thing about this feature is that you can very easily create your own functions for similar use, either to support some other string format like json, xml etc or to create your own functions. For example the following.
At one of his talks Martin said that this might be a possible replacement for xml literals in future versions of scala, meaning that instead of xml being a part of the language it will become an implementation in a library, making the scala language simpler.