L-Briand / KTM

Mustache template engine in kotlin multiplatform
https://mustache.github.io/
MIT License
20 stars 0 forks source link

Support Lambdas #5

Open EdwarDDay opened 1 week ago

EdwarDDay commented 1 week ago

Hey, nice work. I want to know, if you also plan to support lambdas and maybe other optional features of the mustache specification.

L-Briand commented 1 week ago

Hello ! Thank you for the nice words.

Since the birth of my first child, I have less time to update my repos..

Adding lambdas would certainly be a nice addition. I do not know of a way to execute bits of kotlin at runtime without pre-compiling it. It would probably require a tool to extract lambdas and create some sort of kotlin classes containing the code before compilation. Then, this tool can be included in the final project with a gradle plugin.

Unfortunately, this is too complicated at the moment for me to do it. It's still possible to create kotlin lambdas directly when building the context, but it breaks the flow and is not directly inside the template. I know its not the optimal solution.

Concerning inheritance and dynamic names, these do not requires this kind of pre-processing logic so it might be more easy to do them. I will take a look when I got time.