Is there plan to support expressions in string interpolation? For example, I would expect this to work:
"I have \(Num.toStr(2)) apples"
But I get I was expecting an identifier, like \u(message) or \u(LoremIpsum.text).
I believe it's a deliberate choice designed to avoid large expressions in interpolated strings which can be hard to read in other languages.
The idea being that if it doesn't work out well it's easy to relax the rules later. But it's hard to start relaxed and make them stricter later.
Gotcha, that makes sense. Is there plan to add an ability similar to the Display
trait in Rust? Then you could avoid complex expressions but still allow something like "I have \(2) apples"
.
yes
It has been discussed a few times and is almost certainly something we want to add in the future
Last updated: Jul 05 2025 at 12:14 UTC