xiazcy commented on code in PR #3309:
URL: https://github.com/apache/tinkerpop/pull/3309#discussion_r2897107200


##########
gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GValue.cs:
##########
@@ -0,0 +1,128 @@
+#region License
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#endregion
+
+using System;
+
+namespace Gremlin.Net.Process.Traversal
+{
+    /// <summary>
+    ///     Non-generic interface for GValue to allow type-agnostic access in 
GremlinLang.
+    /// </summary>
+    public interface IGValue
+    {
+        /// <summary>
+        ///     Gets the parameter name.
+        /// </summary>
+        string Name { get; }
+
+        /// <summary>
+        ///     Gets the parameter value as an object.
+        /// </summary>
+        object? ObjectValue { get; }
+    }
+
+    /// <summary>
+    ///     A named parameter wrapper that associates a user-defined name with 
a value.
+    ///     GremlinLang renders the name in the gremlin string and stores the 
name-to-value
+    ///     mapping in the parameters dictionary. Replaces the legacy 
Binding/Bindings mechanism.
+    /// </summary>
+    /// <typeparam name="T">The type of the parameter value.</typeparam>
+    public class GValue<T> : IGValue, IEquatable<GValue<T>>
+    {
+        /// <summary>
+        ///     Initializes a new instance of the <see cref="GValue{T}" /> 
class.
+        /// </summary>
+        /// <param name="name">The parameter name. Must be a valid identifier, 
not null, and not start with underscore.</param>
+        /// <param name="value">The parameter value.</param>
+        /// <exception cref="ArgumentNullException">Thrown when <paramref 
name="name" /> is null.</exception>
+        /// <exception cref="ArgumentException">Thrown when <paramref 
name="name" /> is not a valid identifier.</exception>
+        public GValue(string name, T value)
+        {
+            if (name == null)
+                throw new ArgumentNullException(nameof(name), "The parameter 
name cannot be null.");
+
+            if (name.Length == 0)
+                throw new ArgumentException($"Invalid parameter name 
[{name}].");
+
+            if (name[0] == '_')
+                throw new ArgumentException($"Invalid GValue name {name}. 
Should not start with _.");
+
+            if (!char.IsLetter(name[0]))

Review Comment:
   I think I'll leave it at this, mainly b/c if we wanted to keep a specific 
exception message for `_` cases, we'll have to keep the checks separate. 



##########
gremlin-dotnet/test/Gremlin.Net.UnitTest/Process/Traversal/GremlinLangTests.cs:
##########


Review Comment:
   I'm current leaning towards leaving the test name consistent across GLVs. We 
could revisit and change the names later. 



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