Is there a way to disable String templates evaluat...
# compiler
m
Is there a way to disable String templates evaluation in raw string? Other then construct from official docs
val price = """${'$'}9.99"""
? My use case would be embedding of "kotlin source code as string" in custom DSL(similar to
kotlinx.html
tag
sunsafe {raw { """ Kotlin/Any Language code snippet here """}})
g
Not exactly related to compiler. I believe there is an issue with discussion about it, don’t think it’s possible anyway
👍 1
m
I am playing a little bit with an idea to implement this as compiler plugin. Annotation processor can work for generated code like appollo plugin (graphql) (where they "escape" $ signs), but not if raw string are part of the code to edit. I will probably start also with "escaping" inplace first and after learned plugins more, I could think about to introduce a new symbol, like real raw string in back-ticks or so, if it is possible via plugin at all ....
g
There is a couple workarounds, like assign dollar string to another variable, or use different character and replace it, but it's not perfect I think it worth to report your use case in the issue, there is a higher chance that it will be discussed and maybe we will get some official solution
👍 1