eerolanguage/eero

Format String Literal Syntax

Opened this issue · 3 comments

Feature request to circumvent (String stringWithFormat: 'Hello %@%s', 'World', "!"):

Declaring strings from formats should be as easy as:

formattedString := 'Hello %@%s': 'World', "!" // format, ... 
// or
formattedString := ('Hello %@%s': 'World', "!") // (format, ...)

What about string interpolation?

formattedString := 'Hello #{'World'}!'
orta commented

string interpolation is better than a format string IMO

might be a bit weird syntactically though. i like how python does it, so maybe something like:

world := 'World'
formattedString := 'Hello %world' // automatic interpolation from variables
// or
formattedString := 'Hello %world': {'world': world} // explicit interpolation from key/val pairs