As part of my effort to provide a simple server-si...
# language-proposals
s
As part of my effort to provide a simple server-side type-safe templating solution based on Kotlin Script multiline strings and string interpolation (see https://github.com/sdeleuze/kotlin-script-templating), I think I am one step away of the optimal syntax byt Kotlin seems to not accept what I want to do. Current format is
Copy code
import io.spring.demo.*

"""
${include("header")}
<h1>${i18n("title")}</h1>
<ul>
    ${users.joinToLine{ "<li>${i18n("user")} ${it.firstname} ${it.lastname}</li>" }}
</ul>
${include("footer")}
"""
And I would like to use
infix
function to turn it into a more readable:
Copy code
import io.spring.demo.*

"""
${include "header"}
<h1>${i18n "title"}</h1>
<ul>
    ${users.joinToLine{ "<li>${i18n "user"} ${it.firstname} ${it.lastname}</li>" }}
</ul>
${include "footer"}
"""
I am able to declare
infix fun ScriptTemplateWithBindings.i18n(code: String) : String
for example, but on script side it seems impossible to use the infix notation. @ilya.chernikov said me that I probably cannot use
infix
function without explicit first argument (receiver). Do you confirm it is not possible with Kotlin 1.1? Do you agree that would be useful for such use case? Do you think this could be doable, ie. should I create and issue for such improvement request or not