Hi Andrii, Is your proposal for allowing instantiation of custom classes in the grammar intended to be utilized only in addition to the proposal to allow registered custom services as method calls in the grammar? Or are you envisioning the custom classes can be used as arguments for any gremlin step? The example you provided with the has step indicates you would like to enable it for any step.
The reason I am asking is that if we allow the customized classes to be used as arguments for any gremlin step, we also need a mechanism to specify how the customized classes can be evaluated by the steps. For example, how can the customized class be evaluated by a has step which is checking for equality or an order step which needs to compare instances of the customized class with each other? Andrea From: Andrii Lomakin <[email protected]> Date: Monday, November 10, 2025 at 12:42 AM To: [email protected] <[email protected]> Subject: Proposal: Instantiation and caching of classes instances in Gremlin Scrip Good day. This proposal is an extension of my previous proposal of implicit conversion of a service call to a method call according to its registered name. Currently, Gremlin Script supports the creation of instances of certain classes. So I propose to extend it to allow to creation of instances of classes that are provided by AbstractGremlinPlugin implementation. During the application start, the public constructors plus all static public methods that are annotated with the annotation `@FactoryMethod` are registered in the ANTLR-based script engine. Names of extension classes should start with an upper case, and they are allowed only as args of the steps. Instances of extension classes or calls to factory methods can contain instances of other extension classes in a recursive manner. This will allow queries like `g.V().hasLabel("PGVector").has("embedding", PGVectorPredicate.l1Distance(PGVector(,,,), 5))`. I believe that these mechanics, alongside the mechanics of exposing services as method calls, will provide all the means necessary for extending Gremlin by providers, though they will be bound to change some of their DSL to follow a unified approach. WDYT?
