[
https://issues.apache.org/jira/browse/TINKERPOP-1107?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15159977#comment-15159977
]
ASF GitHub Bot commented on TINKERPOP-1107:
-------------------------------------------
GitHub user spmallette opened a pull request:
https://github.com/apache/incubator-tinkerpop/pull/238
TINKERPOP-1107 Added interpreter mode for ScriptEngine
https://issues.apache.org/jira/browse/TINKERPOP-1107
Configuration for the `ScriptEngine` that allows the user to send `def` top
level variables in a script and have them be treated as "global".
Traditionally, for a script like this:
```groovy
def x = 1
int y = 2
z = 3
```
the variables `x` and `y` would be local to that script only while `z`
would be preserved globally for future scripts. Users can find that confusing
especially when using issuing script to Gremlin Server in a "session". When
enabling "interpreter mode", all of the above variables assignments will be
treated as global.
VOTE +1
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/apache/incubator-tinkerpop TINKERPOP-1107
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/incubator-tinkerpop/pull/238.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #238
----
commit c05b1337bc63f1a2d3a7bd2af669e594f2a19e45
Author: Stephen Mallette <[email protected]>
Date: 2016-02-18T15:47:28Z
Allow ScriptEngine to accept scripts in interpreter mode.
Scripts sent with variables normally considered "local" by use of the def
keyword or the inclusion of a type will be treated as global variables when the
InterpreterModeCustomizerProvider configuration is included in the
configuration of the ScriptEngine.
commit 9c78b807ce3728b3b7703bbe5e88b5ddb46c4dd0
Author: Stephen Mallette <[email protected]>
Date: 2016-02-19T15:05:41Z
Added some more asserts around variable scoping with interpreter mode.
----
> Provide a way to support global variables with sandboxing enabled
> -----------------------------------------------------------------
>
> Key: TINKERPOP-1107
> URL: https://issues.apache.org/jira/browse/TINKERPOP-1107
> Project: TinkerPop
> Issue Type: Improvement
> Components: groovy
> Affects Versions: 3.1.0-incubating
> Reporter: stephen mallette
> Assignee: stephen mallette
> Fix For: 3.1.2-incubating
>
>
> If sandboxing is enabled then types have to be defined but if you define the
> type in the script the {{ScriptEngine}} treats it as a local variable.
> That's problematic in sessions.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)