koka-lang / koka

Koka language compiler and interpreter
http://koka-lang.org
Other
3.29k stars 164 forks source link

Support string interpolation #122

Open RandomFrenchman opened 3 years ago

RandomFrenchman commented 3 years ago

In the Koka book, the following syntax is used in order to display a number following a string: println("yielded " + i.show).

It tends to be quite heavy as the number of conversions increases. I think it would be nice to have a string interpolation syntax (maybe "yielded ${i}"?)

exebook commented 3 years ago

This is probably not in the min-gen spirit. I wonder if it's possible to use dot syntax for convenient string concatenation.

m9xiuz commented 3 years ago

Please don't implement it like "yielded ${i}". Typing an extra symbol before each expression is very annoying. Implement it at least like it's implemented in C#: $"yielded {i}". But the most convenient way is of course just "yielded {i}".