scala/scala — pull request #3870 by som-snytt (2014-07-09 04:15:33+00:00)
Title: SIP-24: Arbitrary idents and $" in interpolations

Allow arbitrary identifiers to be interpolated using
simple syntax, including backquoted identifiers.

Identifiers containing a dollar sign must be backquoted.

Accept `$"` for a literal quote.

```
scala> val foo = 42; val foo_ = 43; val foo_* = 44
foo: Int = 42
foo_: Int = 43
foo_*: Int = 44

scala> s"$foo_*"
res0: String = 44

scala> s"$`foo`_*"
res1: String = 42_*

scala> val `a..z` = (0 until 26) map ('a' + _) map (_.toChar)
a..z: scala.collection.immutable.IndexedSeq[Char] = Vector(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z)

scala> s"ABCs: $`a..z`"
res2: String = ABCs: Vector(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z)

scala> val foo$bar = 3
foo|: Int = 3

scala> s"<$`foo$bar`"
res3: String = <3

scala> s"$"Don't quote me on that!$" he objected."
res4: String = "Don't quote me on that!" he objected.
```