https://kotlinlang.org logo
a

aimozg

02/10/2017, 11:15 PM
the
where
function would take an AST representation of the body --effectively it takes source code, and then transcompiles the AST for
it.name == "bob"
into
WHERE c.name == bob
, of the equivalent mongo thing (iirc something resembling
{"where" { eq { field { "fname" }, "bob" }}
20 replies that would mean you'll need to remember which subset of Kotlin is supported in a translator. But if you write your DSL, you'll have limited syntax during compile-time. And I'd rather have features that make creating DSLs and builders easier and less ugly than writing Kotlin-AST-to-DSL transpilers