I have to wonder though, how they plan to do it in less dynamic languages? Just spell out the s-expr and forget about using the language's own syntax?
I have to wonder though, how they plan to do it in less dynamic languages? Just spell out the s-expr and forget about using the language's own syntax?
Expression trees were introduced at the same time as LINQ, to support LINQ.
The actual underlying S-expression syntax for ReQL lambda functions is pretty ugly by itself and I'm glad that so far we haven't had to expose it. The python `lambda x,y: x + y` actually gets compiled to something like the following: `(func [1,2] (add (var 1) (var 2)))`. Variable references have to be constructed manually no matter how you do it. With native lambda functions though you can at least hide those constructions behind the scenes and bind them to the function's formal arguments.
Fortunately though both C++ and Java, the two "traditional" languages we would most like to support, have either just (in C++11) or are about to (in Java 8) introduce lambda functions rendering the point moot.