Is it safe to use <multi-dollar string interpolati...
# compiler
m
Is it safe to use multi-dollar string interpolation in libraries? I'm assuming this does not change the final jar/klib but figured I'd ask before enabling this everywhere.
b
Code seems hard to read
v
Looking at decompiled Java code I would guess that it is safe, because
Copy code
val foo = "foo"
println($$"$foo $$foo")
decompiles to
Copy code
String foo = "foo";
System.out.println("$foo " + foo);
But 🤷‍♂️
m
It seems like it's a frontend only transformation indeed
Perfectly safe
🙌 1
m
Thanks!
j
Regex-based syntax highlighters in shambles
😬 5
m
Like prettier.js?
v
Or text editors with Kotlin syntax but not a full-fledged parser
j
I would assume nearly all of them except anything based on tree-sitter
Even Kotlin's own docs that you linked are highlighted incorrectly
m
Right
Fun stuff
That's a good point. Maybe I can wait a bit
(or forever 😅 )
v
Curious how many will handle
$$
explicitly and not generically any amount of dollars 😄