Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.0-JSR-5
-
None
-
None
Description
When a variable is declared or defined in a script, it should not be added into the binding.
def a = 1
String b = "foo"
Both these variables are local to the script and should not be in the binding.
If someone wants to add a variable to the binding, we should use setProperty("foo", "bar") or simply write:
a = 1
b = "foo"
Putting variables explicitely improves the readability of the code.
And that way, we'll be able to provide type checking in scripts as well, because currently, even if you define a string, you can assign it an integer, because it's simply overriding the variable in the binding.