[ 
https://issues.apache.org/jira/browse/TINKERPOP-2959?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17901796#comment-17901796
 ] 

ASF GitHub Bot commented on TINKERPOP-2959:
-------------------------------------------

Cole-Greer commented on code in PR #2919:
URL: https://github.com/apache/tinkerpop/pull/2919#discussion_r1862701741


##########
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/CoinStep.java:
##########
@@ -29,16 +30,23 @@
 import java.util.Set;
 
 /**
+ * A filter step that will randomly allow traversers to pass through the step 
based on a probability value.
+ *
  * @author Marko A. Rodriguez (http://markorodriguez.com)
  */
 public final class CoinStep<S> extends FilterStep<S> implements Seedable {
 
     private final Random random = new Random();
-    private final double probability;
+    private final GValue<Double> probability;
 
     public CoinStep(final Traversal.Admin traversal, final double probability) 
{
         super(traversal);
-        this.probability = probability;
+        this.probability = GValue.ofDouble(null, probability);

Review Comment:
   The one argument version of `GValue.ofDouble` (without name) is package 
private to discourage use of unnamed GValue's from users. There are a few 
places where unnamed GValues must be constructed to box literals into GValue's, 
however implicitly named variables created by unnamed GValue's will vary each 
time an identical traversal is constructed, which for many providers may limit 
the potential benefits from parameterization. For this reason unnamed GValues 
are discouraged for users.





> Allow the grammar to support parameters
> ---------------------------------------
>
>                 Key: TINKERPOP-2959
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP-2959
>             Project: TinkerPop
>          Issue Type: Improvement
>          Components: language
>    Affects Versions: 3.6.4
>            Reporter: Stephen Mallette
>            Assignee: Stephen Mallette
>            Priority: Major
>             Fix For: 3.7.0
>
>
> Allow the grammar to support parameters similar to how the groovy engine does 
> like, {{g.inject(x,y,z)}}. Doing this will make it easier for a transition 
> away from the groovy engine as a lot of Gremlin in the world today uses 
> parameters. The grammar may have to come with some limitations though as 
> groovy is wide open in terms of what can be treated as a variable. Probably 
> going to keep parameters tied to primitives, collections and tokens/enums 
> like {{Order}} and {{Scope}}. Collections themselves will not contain 
> parameters and things like a {{Traversal}} or {{P}} cannot be treated as one.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to