This was missing for me when I started doing stuff in scala, so I hacked something to be able to do the same in Scala and jump straight to the REPL(unfortunately variables need to be passed explicitly here, but most of the REPL functionality works:
This was missing for me when I started doing stuff in scala, so I hacked something to be able to do the same in Scala and jump straight to the REPL(unfortunately variables need to be passed explicitly here, but most of the REPL functionality works:
I created a library a while ago that does something very similar to what you did, for the groovy language. http://aaronbabcock.blogspot.com/2011/11/groovy-debugging.ht...
It avoided having to pass in variables explicitly by using groovy's AST transform ability (macros) to examine the code for which variables would be in scope and pass those into the repl automatically. I wonder if something similar would be possible in scala?
Users of gdb call it "debugging".
With gdb or jdb that might be theoretically possible but it certainly is not convenient or commonly done. Typically your stretching things with a complicated one liner expression.
But you are right concepts are pretty close, its just that I find a lot of things that call themselves "debuggers" don't have the ability to add new code. Things that call themselves "repls" dont' have the ability to stop at a point or context like a debugger. pdb being the exception. Why can't we have tools that do both things well.
[1] https://coderwall.com/p/xayyvq [2] https://github.com/prismofeverything/schmetterling/
You can set a breakpoint (conditional or not), and have every thing within that context available for you. The next step is to launch an "Evaluation window" where you can execute Java code.
If you were to set the breakpoint at the web-application level (as opposed to plain Java process/class/console-app), you can get information of the Threads and Frames as well.
This techniques have been available for quite some time in the IDEs... that is provided you're not allergic to IntelliJ/NetBeans/Eclipse.
Best part: no code change.
I have no comment for those who prefer VIM/Emacs and bemoaned the lack of powerful stuff they got from other environments.
I am more with the VIM/Emacs crowd though I guess.
I didn't know though that you could create an "evaluation window" in Eclipse. I really liked the refactoring features in Eclipse though and miss them sometimes.
http://www.cavdar.net/2008/09/13/5-tips-for-debugging-java-c...
- You can set breakpoint only for "Exception"
- You can set "Step Filtering" to avoid JDK standard classes (or libraries that you know won't cause the bugs)
- The Expression Evaluation also supports code-assist/code-completion
It's really tough to beat IDEs like Eclipse and IntelliJ these days with plenty contributors and strong companies behind them churning new features everyday.