String interpolation works fine in this case:
val name = "Bill"
val result = s"My Name is ${name}"
When I introduce it to the variable it didn't get interpolated value:
val name = "Bill"
val greeting = "My Name is ${name}"
val result = s"${greeting}"
Direct wrapping of greeting is not appropriate solution, I must handle greeting like a plain String.
greetingmakes no sense, as it's already a string(name: String) => s"My Name is ${name}"? Or do you wantnameto be bound dynamically to whichever variable called name is in scope at the time you calls"${greeting}"? Hint: go with the function either way. It's far less confusing.resultis expected, and it's OK not to care what the type ofgreetingis, just as users don't care what the expressions"$greeting"actually does.