I think this is generally on the right track as there aren't many other
tracks to get this to work. Is it possible to leave open the option for a
language that is translating into itself (e.g. javascript to javascript) to
have the ability to take a non-string lambda if it is a language that is
capable of inspecting itself to get the string representation of its own
code?

On Thu, Jun 16, 2016 at 2:12 AM, Daniel Kuppitz <[email protected]> wrote:

> 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/>
> > >
> > >
> > >
> >
> >
>

Reply via email to