2 ms·
Not necessarily just from a debugging perspective (though I did mention debugging, specifically, above), but from an exploratory programming perspective. The ab
by SwellJoe 11y ago
Not necessarily just from a debugging perspective (though I did mention debugging, specifically, above), but from an exploratory programming perspective. The ability to start with a snippet of something, and then trying new things. I often don't know how to solve something until I've tried several ways of doing it. A REPL (a really functional one like iPython, or, I imagine the better Lisp or Smalltalk REPLs, though I've rarely used either language) is a really nice way of doing that.
A debugger, in my mind, is for running the program as it exists on disk and then inspecting it. A REPL is for interactively writing a new program. It is a different way of thinking about programming. On one hand it's something you do first in your editor and then you fix the bugs in the debugger. On the other hand, it's something you tinker with until you're happy and then you commit it to disk. Even when I worked in Python, I would mostly write the code in vim, but when I was trying to understand a new library or sort out the right data structure or algorithm for something I'd use the REPL.
I guess the lines are blurry. iPython is called a Python shell, or was when I was using it. So, saying "REPL" may be misleading, if your vision of a REPL is merely "it executes a statement". You can build up quite complex functions in iPython and execute them on arbitrary data. It doesn't restrict you to one-liners.
If the Perl 6 debugger allows defining new functions (and other stuff beyond merely tweaking data), then it's probably in a similar category, if still immature.