I tried doing the following in Roc:
"Hello ${Err("No name provided") ?? "Jane"}!"
Which produces the following error message:
── SYNTAX PROBLEM ──────────────────────────────────────────────────────────────
This string interpolation is invalid:
4│ "Hello ${Err("No name provided") ?? "Jane"}!"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
String interpolations cannot contain newlines or other interpolations.
You can learn more about string interpolation at
<https://www.roc-lang.org/tutorial#string-interpolation>
This seems odd as there's no newlines and/or other interpolations. The tutorial also states that I'm allowed to put entire single-line expressions inside ${}
. Have I hit a limitation of the compiler here?
Interesting
I guess this is for to how??
desugars
It becomes a when ... is
Ah, of course! I forgot that it's sugar just like the postfix ?
is sugar for Str.concat
...
Still somewhat surprising since it looks like a single-line expression.
I think that _ought_ to work, but just doesn't because bugs
Worth reporting or will the new compiler most likely solve it?
Joshua Warner said:
I think that _ought_ to work, but just doesn't because bugs
Yeah, totally agree
Kevin Hovsäter said:
Worth reporting or will the new compiler most likely solve it?
Hopefully the new compiler will just fix this, but no guarantees. Might be worth just filing as a reminder.
Last updated: Jul 05 2025 at 12:14 UTC