groostav
02/14/2017, 3:05 AMwhere
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" }}
32 replies
@pniederw regarding using macros in kotlin, I actually think Linq is a stroke of genius when it comes to macros: a huge amount of the bugs in macros comes from a failure to properly apply the front-end of a compiler; a macro author is tempted to start rooting-around in string values of source code, which is begging for disaster. But by productizing (APIzing? weaponizing?) the AST in the way microsoft did, they basically did an enormous amount of the heavy lifting needed by macros for the would-be macro author.
In short, this feature would enable a huge number of macro-like functionalities without the kinds of horrifying bugs you often associate with macros.