andreachild commented on code in PR #3253:
URL: https://github.com/apache/tinkerpop/pull/3253#discussion_r2467540172


##########
docs/src/upgrade/release-3.8.x.asciidoc:
##########
@@ -192,14 +192,56 @@ version, the `none()` step was used to "throw away" all 
traversers that passed i
 renamed to `discard()`. The `discard()` step with its verb tone arguably makes 
for a better name for that feature, but
 it also helped make room for `none()` to be repurposed as `none(P)` which is a 
complement to `any(P)` and `all(P) steps.
 
-==== Prevented using cap() inside repeat()
+==== Prevented using cap(), inject() inside repeat()
 
 `cap()` inside `repeat()` is now disallowed by the 
`StandardVerificationStrategy`. Using `cap()` inside `repeat()` would
 have led to unexpected results since `cap()` isn't "repeat-aware". Because 
`cap()` is a `SupplyingBarrier` that reduces
 the number of traversers to one, its use inside `repeat()` is limited.
 
 See: link:https://issues.apache.org/jira/browse/TINKERPOP-3195[TINKERPOP-3195]
 
+`inject()` inside `repeat()` is now also disallowed by the 
`StandardVerificationStrategy`. The usefulness of `inject()` 
+inside `repeat()` is questionable as the injections are exhausted after one 
iteration. Consider the following examples, 
+noting that the examples for version 3.7.4 demonstrate the effect of 
`RepeatUnrollStrategy` on `inject()` semantics, 
+which is problematic as strategies should not affect results. 3.8.0 examples 
do not disable the `RepeatUnrollStrategy` 
+as the strategy was modified to be more restrictive in this version.
+
+[source,text]
+----
+// 3.7.4 results in data injected for each repeat loop
+gremlin> g.inject('x').repeat(inject('a')).times(5)
+==>a
+==>a
+==>a
+==>a
+==>a
+==>x
+
+// 3.7.4 without RepeatUnrollStrategy injections occur only once
+gremlin> 
g.withoutStrategies(RepeatUnrollStrategy).inject('x').repeat(inject('a')).times(5)
+==>a
+==>x
+
+// 3.8.0 inject() inside repeat() now produces an error
+gremlin> g.inject('x').repeat(inject('a')).times(5)
+The parent of inject()-step can not be repeat()-step: 
InjectStep(java.util.ArrayList$Itr@543da15)
+----
+
+Before upgrading, users should look for usages of `inject()` inside `repeat()` 
and if it is determined that per-loop 
+injections are desired, it is possible to use `union()` and `constant()` 
instead.
+
+[source,text]
+----
+// 3.8.0 can use union() and constant() inside repeat() instead of inject()
+gremlin> 
g.inject('x').repeat(union(constant('a').limit(1),identity())).times(5)

Review Comment:
   I added multiple values as an additional example



-- 
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