Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
Description
Groovysh looks like an interpreter-REPL, but it really compiles every complete snippet of lines as a script ad runs the compiled scripts. This has the severe usability / learnability issue that unbound variables do not get stored in the running session, i.e.:
groovy:000> def x = 3
===> 3
groovy:000> x
Unknown property: x
The main problems here is that plenty of valid code from books/tutorials will not run unless the declaration is manually removed by users. The same goes for copy&pasting any other Java/Groovy code into the running session, it will break on any variable declarations.
Based on discussions with user@groovy.codehaus.org and dev@groovy.codehaus.org:
http://groovy.329449.n5.nabble.com/groovysh-variable-declarations-td5717853.html
http://groovy.329449.n5.nabble.com/Fwd-groovy-user-groovysh-variable-declarations-td5718024.html
I want to open this issue on JIRA to track it.
I have a current prototype implementation that is not pretty but works, with caveats.