terminusdb-client-js icon indicating copy to clipboard operation
terminusdb-client-js copied to clipboard

Support for isolated variables would be helpful

Open hoijnet opened this issue 2 years ago • 1 comments

Is your feature request related to a problem? Please describe. Today, generated variables are AFAIK not generated with unique names, which is an advantage in some scenarios. In other scenarios, it is helpful to get isolated variables. Thus, adding a flag to get variables with a cryptographically unique id as a suffix would help make them local

Describe the solution you'd like Add an optional flag to the WOQL.vars() function to generate unique variable names.

Describe alternatives you've considered Write a local function in own code for it.

Additional context Adding the feature request to get a conversation going.

hoijnet avatar Feb 24 '23 12:02 hoijnet

A locally scoped variable would thus be created like so:

const [localVariable] = WOQL.localVars("localVariable")

As the vars is bound to take all parameters, it would not look nice to have the last for first one be a boolean for local, probably better to introduce localVars.

hoijnet avatar Feb 24 '23 12:02 hoijnet