4 ms·
Not sure I understand, maybe your development process differs from mine. Could you give me an actual example on how you use REPL during development?
by pawadu 9y ago
Not sure I understand, maybe your development process differs from mine.
Could you give me an actual example on how you use REPL during development?
- TeMPOraL 9y agoFor iteratively developing a piece of code. For quickly checking what a function X does with arguments Y and Z. For interactively manipulating a data structure until I finally know exactly what transformation I want to do, which I then save in the source code. For exploring and possibly modifying the run-time state of the program. Simply being able to repeatedly invoke functions from the REPL without breaking your flow changes the way you program. It's a completely different experience from the usual edit->compile->run cycle, and even from the TDD edit->run tests cycle. Also, if the language didn't just bolt a REPL on top of itself because it's fashionable, but actually was designed as an interactive programming medium, you'll have powerful introspection and runtime code modification possibilities that together speed up the debugging process. (Experienced readers will know which language families I have in mind here - the ones which surprisingly weren't even mentioned in JEP222 which this article links to).
- pawadu 9y agoThis makes sense if you are using JavaScript or Python. But not Java, which is statically typed and an IDE that takes care of most of the stuff you mentioned. edit: java also has hot swapping of running code.
- TeMPOraL 9y agoI do Java for my $dayjob and I can tell you that while IDE helps a lot with types and moving around the code, it doesn't give you interactivity offered by a proper REPL. (Conversely, a language with a decent support for interactivity enables IDE developers to provide tools further enhancing interactive programming.)
- piva00 9y agoHot swapping breaks in arcane ways that most people won't bother searching how to avoid, code swap is simply considered unreliable by most of my colleagues. But this is anecdotally speaking, of course.
- aisofteng 9y agoI'm also curious. I routinely use the Python REPL, for example; so it's not that I don't see how a REPL can be useful - it's that Java is so much more verbose that I find it difficult to imagine using a Java REPL. I struggle to think of a good use case for this.
- TeMPOraL 9y agoJava is not that verbose anymore. Java 8, in particular, made the language much more concise. Also, I expect Java IDEs will offer their power of autocomplete to be usable in REPL too.