You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tinkerpop.apache.org by "Matt Frantz (JIRA)" <ji...@apache.org> on 2015/10/20 04:24:27 UTC

[jira] [Commented] (TINKERPOP3-900) Provide by(object) which compiles to by(constant(object))

    [ https://issues.apache.org/jira/browse/TINKERPOP3-900?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14964405#comment-14964405 ] 

Matt Frantz commented on TINKERPOP3-900:
----------------------------------------

I am ambivalent about this change.  It would, indeed, allow for syntactic sugar in the case you specify, but it would also make it really easy to pass the wrong type of argument.  Very few types would really make sense at runtime, but all types would be acceptable to the compiler.  And how would Java resolve a lambda in the case where the wrong number or type of arguments are declared?  Would that become {{Object}} and thus a constant?

> Provide by(object) which compiles to by(constant(object))
> ---------------------------------------------------------
>
>                 Key: TINKERPOP3-900
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP3-900
>             Project: TinkerPop 3
>          Issue Type: Improvement
>          Components: process
>    Affects Versions: 3.0.2-incubating
>            Reporter: Marko A. Rodriguez
>            Assignee: Marko A. Rodriguez
>             Fix For: 3.1.0-incubating
>
>
> Right now, this is how you can increment a sack.
> {code}
> sack{a,b -> a+1}
> {code}
> OR, lambda free:
> {code}
> sack(sum).by(constant(1))
> {code}
> I think we should make a {{by()}}-modulator that is:
> {code}
> sack(sum).by(1)
> {code}
> That is:
> {code}
> by(object) -> by(constant(0)).
> {code}
> In fact, we have an {{AbstractLambdaTraversal}} called {{ConstantTraversal}} which will make this even faster (analogous to {{LoopTraversal}} being used instead of {{until(loops().gt(4))}}.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)