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

Florian Hockmann commented on TINKERPOP-1752:
---------------------------------------------

I just pushed the branch 
[TINKERPOP-1752|https://github.com/apache/tinkerpop/tree/TINKERPOP-1752] with 
my current progress.

A few notes on problems that need to be resolved:
1) Java types where we have no C# equivalent. This includes for example: 
{{Function}}, {{Consumer}}, or {{Comparator}}. I usually just used {{object}} 
here, but that leads to method overloads with an identical combination of 
parameter types:
* In {{GraphTraversalSource}}: {{WithSack}} and {{WithSideEffect}}
* In {{GraphTraversal}}: {{By}}

2) {{GraphTraversalSource.WithoutStrategies}} is problematic as it expects to 
get the {{Class}} of  the {{TraversalStrategy}}. We probably have to manually 
change this to use an object of {{ITraversalStrategy}}, but then we also have 
to change the parameter name from {{traversalStrategyClasses}} to 
{{traversalStrategies}}.

3) Some generic methods in {{\_\_}} don't have a generic counterpart in 
{{GraphTraversal}} with the same arguments. (Currently, the methods are: 
{{Fold}}, {{Limit}}, {{Range}}, and {{Tail}}.) I mostly solved this problem 
with a special handling for those methods that simply omits the generic type 
parameter when calling the method in {{GraphTraversal}}. However, this isn't 
enough for {{__.Fold()}} which currently looks like this:
{code}
public static GraphTraversal<object, IList<E2>> Fold<E2>()
{
    return new GraphTraversal<object, IList<E2>>().Fold();
}
{code}

but it needs to be like this:
{code}
public static GraphTraversal<object, IList<E2>> Fold<E2>()
{
    return new GraphTraversal<object, E2>().Fold();
}
{code}
So we probably need another special handling to change the 2. generic type 
parameter of the created {{GraphTraversal}} here to {{E2}} instead of 
{{IList<E2>}}.

> Gremlin.Net: Generate completely type-safe methods
> --------------------------------------------------
>
>                 Key: TINKERPOP-1752
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP-1752
>             Project: TinkerPop
>          Issue Type: Improvement
>          Components: language-variant
>    Affects Versions: 3.2.5
>            Reporter: Florian Hockmann
>            Priority: Minor
>
> Currently the generated traversal methods in Gremlin.Net take {{params 
> object[] args}} as an argument which allows the user to provide an arbitrary 
> number of arguments with any type. While this makes the generation rather 
> simple, it doesn't tell the user which arguments are actually valid so users 
> can submit completely invalid traversals like:
> {code}
> g.V(1).AddE(1234, "invalidArgument2").Next()
> {code}
> Type-safe methods could also use the original argument names to tell users 
> something about what kind of values the methods expect. Consider for example 
> the following method signatures for the C# step {{AddE}} that are basically a 
> 1:1 representation of the original Java {{addE}} step:
> {code}
> public GraphTraversal< S , Edge > AddE (Direction direction, string 
> firstVertexKeyOrEdgeLabel, string edgeLabelOrSecondVertexKey, params object[] 
> propertyKeyValues);
> public GraphTraversal< S , Edge > AddE (string edgeLabel);
> {code}
> Implementing this should make TINKERPOP-1725 obsolete and also resolve 
> TINKERPOP-1751.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to