I wouldn't say that I like it, cause code as a String will always be very error prone, but still, it's likely the only way to get lambdas working in all language variants. Hence: "cool".
Cheers, Daniel On Thu, Jun 16, 2016 at 12:03 AM, Marko Rodriguez <[email protected]> wrote: > Hi, > > What do people think of this idea: > > https://gist.github.com/okram/df6a104bde51a4f4f6f0da11f46909d5 < > https://gist.github.com/okram/df6a104bde51a4f4f6f0da11f46909d5> > > If you pass a lambda/closure/anonymousFunction/etc. in the respective > language (during translation), it calls it to get the string > representation. … ? > > Marko. > > http://markorodriguez.com > > > > > On Jun 15, 2016, at 10:50 AM, Marko Rodriguez <[email protected]> > wrote: > > > > Hello, > > > > I think we should introduce an S object. It would stand for Script and > would allow you to do: > > > > S.f(“{ it.length }”) > > > > Where does this come in handy? Language variants. > > > > Imagine using gremlin_python that will compile to Gremlin-Groovy for > execution at GremlinServer. > > > > g.V().out(“knows”)[0:2].name.map(f(“{ it.length }”)) > > > > Next, imagine you are in Gremlin-Java and want to submit a traversal to > GremlinServer, but it has a lambda. No worries, just use the > GroovyTranslator and you have: > > > > g.V().out(“knows”).limit(2).values(“name”).map(f(“{ it.length }”)) > > > > We could also have: > > > > S.s = supplier > > S.c = consumer > > S.f = function > > S.o = operator > > > > This gets to the general problem of being able to translate lambdas > between different languages as well as being able to send lambdas over the > wire. > > > > Thoughts?, > > Marko. > > > > http://markorodriguez.com <http://markorodriguez.com/> > > > > > > > >
