Search code examples
scalalanguage-featureslanguage-design

Why is there no string interpolation in Scala?


This is not just an idle quip... I wonder if anybody knows if there's an actual design reason why Scala does not support interpolation similar to Groovy and other "syntactically better Javas"?

e.g.

var str1 = "World";
var str2 = "Hello, ${str1}";

Solution

  • The proposed solution is to omit spaces when using +.

    "a="+a+", b="+b
    

    It has been suggested that a Swiss keyboard layout makes this very natural to type, so the creators of Scala don't feel enough pain to justify complicating the langauge in this direction :)