Github user FlorianHockmann commented on the issue:

    https://github.com/apache/tinkerpop/pull/792
  
    > Can we make Lambda class static and make the Lambda.Groovy() and 
Lambda.Python() return an ILambda interface?
    
    Sure, making the implementation internal makes perfect sense to me.
    
    But what do you think about the question of whether we want to return a 
general `ILambda` interface vs specific `IFunction` interfaces and so on?
    
    So first approach (basically the current one in this PR):
    ```cs
    public static class Lambda
    {
        public static ILambda Groovy(string expression)
        {
            return new StringBasedLambda(expression, "gremlin-groovy");
        }
    
        public static ILambda Python(string expression)
        {
            return new StringBasedLambda(expression, "gremlin-python");
        }
    }
    ```
    
    alternative approach:
    
    ```cs
    public static class Lambda
    {
        public static string DefaultLanguage { get; set; } = "gremlin-groovy";
    
        public static IFunction Function(string expression, string language)
        {
            return new StringBasedLambda(expression, language);
        }
    
        public static IPredicate Predicate(string expression, string language)
        {
            return new StringBasedLambda(expression, language);
        }
    
        // ...
        
        public static IPredicate Predicate(string expression)
        {
            return Predicate(expression, DefaultLanguage);
        }
    
        // ...
    }
    ```


---

Reply via email to