Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better describe how groovy binding works #2

Open
samrocketman opened this issue Jan 13, 2017 · 0 comments
Open

Better describe how groovy binding works #2

samrocketman opened this issue Jan 13, 2017 · 0 comments

Comments

@samrocketman
Copy link
Contributor

If a variable has an undeclared type it goes into the script binding. The binding is visible to all methods which means data is shared.

evaluate() is a helper method to allow the dynamic evaluation of groovy expressions using this scripts binding as the variable scope.

In a variable binding, you can declare a closure which accepts no argument and must be restricted to calls without arguments.

With all of that in mind, here is your script working as intended.

evaluate ("test = { -> println \"Test is successful!\" }")
test()
@samrocketman samrocketman changed the title better describe how groovy binding works Better describe how groovy binding works Jan 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant