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