Stream: show and tell

Topic: expressions in string interpolation


view this post on Zulip Richard Feldman (Jul 30 2023 at 04:23):

as of https://github.com/roc-lang/roc/pull/5707 you can now use expressions in string interpolation, e.g. "this is a number: \(Num.toStr someNumber)"

view this post on Zulip Richard Feldman (Jul 30 2023 at 04:24):

the new rules for string interpolation are:

that's it!

view this post on Zulip Richard Feldman (Jul 30 2023 at 04:24):

that means you can also do quotes in there if you want, e.g. "comma-separated: \(Str.joinWith ["a", "b", "c"] ", ")"

view this post on Zulip Brendan Hansknecht (Jul 30 2023 at 13:15):

Exciting

view this post on Zulip Brendan Hansknecht (Jul 30 2023 at 13:15):

That will be nice in many scripts

view this post on Zulip Georges Boris (Aug 15 2023 at 19:18):

when you say "no interpolation inside other interpolations" - is that only for inline stuff or does it actually care if Str.joinWith uses interpolation in its implementation?

view this post on Zulip Sven van Caem (Aug 15 2023 at 20:05):

Only for inline stuff! The implementation of the functions used doesn't matter.


Last updated: Jul 05 2025 at 12:14 UTC