I concur with Robert.

Kuppitz has done a lot to help in this area with NumberHelper. We should make 
sure it is propagated throughout. 
        
https://github.com/apache/tinkerpop/blob/master/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/util/NumberHelper.java
 
<https://github.com/apache/tinkerpop/blob/master/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/util/NumberHelper.java>

Can you please make a ticket about your particular ChooseStep situation?

        https://issues.apache.org/jira/browse/TINKERPOP/ 
<https://issues.apache.org/jira/browse/TINKERPOP/?selectedTab=com.atlassian.jira.jira-projects-plugin:summary-panel>

Thank you,
Marko.

http://markorodriguez.com



> On Feb 1, 2017, at 8:03 AM, Robert Dale <[email protected]> wrote:
> 
> It absolutely would make sense to treat numbers as numbers and not as data
> structures.  This is one of those things that keeps gremlin tied to a Java
> implementation and from being language-agnostic.
> 
> Robert Dale
> 
> On Wed, Feb 1, 2017 at 9:51 AM, Ted Wilmes <[email protected]> wrote:
> 
>> Hello,
>> I wrote a traversal using a choose that included a count in the branching
>> traversal.  Here is a simplified version:
>> 
>> g.V().choose(bothE().count()).option(1, constant(1)).option(3,
>> constant(3))
>> 
>> I wasn't getting any results and then realized none of the options would
>> match because count produces a long.
>> This is the correct behavior now and makes sense in the context of Java's
>> type system but I was wondering if it
>> wouldn't make sense to handle the type coercion from int to long so the
>> user could use an integer?  I think this
>> would be consistent with how other steps like 'is' works:
>> 
>> gremlin> g.V().local(bothE().count()).is(3)
>> ==>3
>> ==>3
>> ==>3
>> 
>> 
>> Full example:
>> gremlin> g = TinkerFactory.createModern().traversal()
>> ==>graphtraversalsource[tinkergraph[vertices:6 edges:6], standard]
>> gremlin> g.V().choose(bothE().count()).option(1, constant(1)).option(3,
>> constant(3))
>> gremlin> g.V().choose(bothE().count()).option(1l, constant(1)).option(3l,
>> constant(3))
>> ==>3
>> ==>1
>> ==>3
>> ==>3
>> ==>1
>> ==>1
>> 
>> 
>> Thanks,
>> Ted
>> 

Reply via email to