spmallette commented on code in PR #2367:
URL: https://github.com/apache/tinkerpop/pull/2367#discussion_r1410644880


##########
docs/src/reference/the-traversal.asciidoc:
##########
@@ -5097,6 +5097,17 @@ new transaction immediately following the `commit()` 
that raises the events. The
 may also not behave as "snapshots" at the time of their creation as they are 
"live" references to actual database
 elements.
 
+=== ExplainStrategy

Review Comment:
   this change seems to create a new and additional way to do explain in Java 
where only this new one works in non-JVM languages? there's always going to be 
little differences among the various languages but this one seems really 
fundamental. everyone knows the `explain()` and I don't think there should be 
another way to do it.  
   
   I see the complexity of the `explain()` signature in trying to make this 
change - it returns `TraversalExplanation` rather than `Traversal` and is 
effectively a form of terminal step. 
   
   I don't know if this makes this change much more elegant, but couldn't you 
remove the user need to know about `ExplainStrategy` if `Traversal.explain()` 
added it and then self-iterated to return the `TraversalExplanation`?
   
   In Java, I suppose you would self-iterate a clone so that you could still do:
   
   ```
   gremlin> t = g.V().out();[]
   gremlin> t.explain()
   ==>Traversal Explanation
   
==========================================================================================
   Original Traversal                    [GraphStep(vertex,[]), 
VertexStep(OUT,vertex)]
   ConnectiveStrategy              [D]   [GraphStep(vertex,[]), 
VertexStep(OUT,vertex)]
   ...
   Final Traversal                       [TinkerGraphStep(vertex,[]), 
VertexStep(OUT,vertex)]
   gremlin> t
   ==>v[3]
   ==>v[2]
   ==>v[4]
   ==>v[5]
   ==>v[3]
   ==>v[3]
   ```
   
   On the idea of a completely different approach, I can't help wondering if 
"explain" isn't a form of `GraphOp`, like transactions are (i.e. a special form 
of `Bytecode` that trigger a particular command on the server). Did you 
consider that?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to