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

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

Github user jorgebay commented on the issue:

    https://github.com/apache/tinkerpop/pull/792
  
    The implementation looks great and the final `GraphTraversal` and 
`GraphTraversalSource` APIs make a lot of sense, like:
    
    ```csharp
    public GraphTraversal<S, E2> Branch<E2> (IFunction function) {}
    ```
    
    This enables us that if we wanted to in the future, we could implement a 
lambda in C# that takes a `Func<T, TResult>`, like:
    
    ```csharp
    IFunction fn = Lambda.GetFunction<string, int>(text => text.length)
    int traversal.Branch(fn).Next();
    ```
    
    Just 1 suggestion:
    Can we make `Lambda` class `static` and make the `Lambda.Groovy()` and 
`Lambda.Python()` return an `ILambda` interface?
    
    ```csharp
    public interface ILambda : IFunction, IBiFunction, IPredicate,
                               IUnaryOperator, IBinaryOperator, IComparator, 
IConsumer, ISupplier
    ```
    
    ```csharp
    // Make the implementation internal
    internal class StringBasedLambda: ILambda
    {
      public string LambdaExpression { get; }
      public string Language { get; }
      public object Arguments { get; }
      public Lambda(string expression, string language)
      {
        // ...
      }
    }
    ```
    
    Then, the serializers could take an `ILambda`: `{typeof(ILambda), new 
LambdaSerializer()}`


> Support lambdas in Gremlin.Net
> ------------------------------
>
>                 Key: TINKERPOP-1854
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP-1854
>             Project: TinkerPop
>          Issue Type: Improvement
>          Components: dotnet
>    Affects Versions: 3.3.0, 3.2.6
>            Reporter: Florian Hockmann
>            Assignee: Florian Hockmann
>            Priority: Major
>             Fix For: 3.2.8, 3.3.2
>
>
> Gremlin.Net should support lambdas. We already discussed this in [the pull 
> request for TINKERPOP-1752|https://github.com/apache/tinkerpop/pull/712]. 
> Here is what [~spmallette] said over there:
> {quote}
> Any reason we don't support lambdas? Even if .NET can't support them natively 
> for some reason wouldn't we minimally support the ability to pass a 
> python/groovy/etc lambda? it's kinda weird that way, but i think back to the 
> point that kuppitz made on the dev list the other day where he stated that he 
> doesn't always find a way out of using lambdas in production systems he works 
> on - so ultimately users will need that kind of capability i think.
> {quote}
> C# lambdas would require some kind of C# parser on the server side, so at 
> least in the beginning a way to send lambdas from already supported languages 
> in Gremlin.Net should be enough.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to