[ https://issues.apache.org/jira/browse/TINKERPOP-2990?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17787383#comment-17787383 ]
Valentyn Kahamlyk commented on TINKERPOP-2990: ---------------------------------------------- Adding setter is quite a risky move. Currently Client can only work with one Connection, and Connection not designed to work with several Clients. Connection constructor use same options as Client constructor, so technically, a Client-created Connection will be exactly the same as Connection created in other place. Do you have an example of when setter is needed? > Javascript GLV: Add getters and setters for Client and Connection classes > ------------------------------------------------------------------------- > > Key: TINKERPOP-2990 > URL: https://issues.apache.org/jira/browse/TINKERPOP-2990 > Project: TinkerPop > Issue Type: Improvement > Components: javascript > Affects Versions: 3.7.0 > Reporter: Taylor Riggan > Priority: Critical > > Java provides the ability to override a class constructor, which has allowed > a Client or Connection class in Java to be instantiated using varying > different parameters. Javascript classes only allow a single constructor. > This limits a developer's ability to access or modify class properties for a > Client or Connection object. > Example: > A DriverRemoteConnection object in gremlin-javascript can only be > instantiated via: > {code:java} > let drc = new DriverRemoteConnection(some_url);{code} > A developer would not be able to create a Client object first and create a > new DriverRemoteConnection object based on the Client as they would be able > to do using the Java GLV. > > Similarly, if a user needed to gain access to an underlying Client or > Connection object from within a DriverRemoteConnection, they would be > accessing these properties using the _client or _connection variable names. > The underscore prefix typically denotes that these should be viewed as > private class properties. As such, we should be treating these as private > until a time comes as to when we can adopt actual private class properties > and functions (a fairly new concept added to JS in ES2019). > To address these issues, I suggest we add setter and getter functions to the > respective classes that would allow a user to more properly interact with > class properties that cannot be defined via overridden constructor. -- This message was sent by Atlassian Jira (v8.20.10#820010)