why doesn't this compile : `val one = """text \$te...
# announcements
t
why doesn't this compile :
val one = """text \$text"""
it won't escape the $. Works fine in a normal string. how do I turn of templating in raw strings?
z
“””${‘$’}”””
🤣 1
t
brutal....
not really much of a "raw string" if it's got templating in it.... is it?
"...contains no escaping..." oh.. except the '$' charactor.
I use $ in regex all the time. but I use normal strings, in which case \$ works fine.
it's fine. ${'$'} works. I just wish it was clearly documented someplace.
e
it is documented, right there in the language documentation?
t
really? It just says the bit about "...contais no escaping.. " but templating works. It doesn't say how to escape the templating. It does say how for normal string. \$. but not ${'$'} for raw strings.
true
maybe they'll make a "really actually raw string". Although it's really only useful for code generation... and there are libs for that.
e
e.g. kotlinpoet already knows how to emit literal strings with whatever content you desire
heh. reminds me of terminal modes: raw (unprocessed), cooked (processed), and rare (somewhere in between)
t
I used kotlinpoet a lot. This problem came up because I have a base class all the kotlinPoet code extends. But I keep it as a string because I'm not sure of the eventual package name...o
y
I mostly use
${"$"}
in this case because it looks neat enough
p