Hi everyone,

Given the general desire to avoid breaking changes to gremlin semantics between 
3.8 and 4.0 [1], I wanted
to consider if there are any remaining semantics breaks which are preferable to 
take now as opposed to
later. One longstanding pain point is over the current state of has(k, 
Traversal) which has long been confusing
and unintuitive  [2]. If we can get predicates to accept Traversals in TP4, we 
should change has(k, Traversal)
such that the traversal is used to produce a value to check for equality, 
instead of the current semantics which
only check if the traversal is productive. If these are the semantics we 
ultimately want in 4, I think its preferable
to first take the break in 3.8 by removing the old has(k, Traversal) now, which 
would set us up to cleanly add a
new has(k, Traversal) with the intuitive equality-based semantics in TP4. I’m 
not aware of any usages of the
existing semantics which could not easily be translated to use the where() step 
instead. Given the amount of
confusion generated by the old semantics, I think there’s a reasonable argument 
that a plain takeaway here is
actually a net benefit.

Additionally, given the work that’s recently gone into clarifying choose() 
semantics [3], I think it would make sense
to make the same change to choose().option(Traversal, value). The traversal in 
this case operates in the same
manner as the current has(k, Traversal), but once again the intuitive semantics 
is that the traversal should produce
a value which is checked for equality. Once again I propose we takeaway this 
option in 3.8 to set up a clean
addition of improved semantics in TP4. I’m not aware of the current 
choose().option(Traversal, value) getting much
use, but any existing usage patterns of this could be rewritten to use union() 
instead, with filters prepended to
each branch traversal.

Let me know if you have any thoughts/concerns about the proposed changes.

Thanks,
Cole

[1]: https://lists.apache.org/thread/3f7myl9t46mb1rj1hwr6xmttom1kwgwm
[2]: https://issues.apache.org/jira/browse/TINKERPOP-1463
[3]: https://issues.apache.org/jira/browse/TINKERPOP-3178

Reply via email to