4 ms·
I feel there should be a different word available for a REPL that you can call out into from your own code, where the REPL has access to the lexical scope at th
by barrkel 12y ago
I feel there should be a different word available for a REPL that you can call out into from your own code, where the REPL has access to the lexical scope at the point of the call. Like binding.pry in Ruby, or 'debugger' in Javascript.
A REPL that doesn't let me break out with current lexical scope only gives me 10% of what I use a REPL for. Without that feature, they're of limited use; more suited to playing with a language than productively writing and debugging code.
- igravious 12y agointeractive go shell (igo?) a la interactive ruby shell (irb)
- ChrisGaudreau 12y agoA Pry for Go would be enough to make me switch fully to Go.
- StefanKarpinski 12y agoThere is a name for a "REPL" that does what you're describing: a debugger. REPL stands for "read eval print loop", which is what precisely this is and not what you're describing at all.
- barrkel 12y agoNo, a debugger is something that supports, at a minimum, breakpoints, stepping and memory inspection. Many debuggers - if not most - do not support arbitrary constructs in the language being debugged. They don't normally support creating new variables (by which I explicitly do not mean a name for an expression). And they very rarely support writing new or overwriting existing functions. When I use pry, it's normally as a REPL with scope bindings, not as a debugger. That is, I don't use it for breakpoints or stepping. I use it to write code in the context of where the code is going to live. When I need to modify a Ruby method, I stick a binding.pry in it, then write the new code iteratively in the console in the context of a test or seed data, and copy and paste finished code into an editor when I'm happy with the results. A REPL that only supports creating new definitions is simply not very useful to me. It doesn't support what I use REPLs for. They're mostly just toys - IMO.