Nice. I recently have been doing a bash deep dive and realizing that treating it like repl driven development is very useful. Been wondering if this is worth writing about for others.
You can also just execute another ‘bash’ process, of course the environment is a bit different
Imagine if that man-millennium of engineering had been spent working on a decent language and ecosystem instead of C, C++ and Objective-C!
That’s what gets me: better languages are able to scrape by with several orders of magnitude less investment, precisely because they are better — but imagine how much more progress we as an industry would have made had we only invested a little more in those more promising ecosystems and a little less in the terrible ones.
> Modern debuggers have specialized capabilities way beyond the reach of REPLs.
Only if you are running on a machine with a full OS.
Embedded debugging is so bad that Microsoft forcing everybody to use DAP (Debug Adapter Protocol) was a step up.
It also doesn't help that compiler writers never met an optimization that they didn't like. It's often really hard to unwind optimized code back to something useful to probe. Sure, you can turn on debug optimizations but then your code runs an order of magnitude slower.
You can inspect any expression, break into the debugger mid-execution, change the code, whatever code you feel like, redo the execution after applying the changes for example.
The ultimate redo-eval-loop, with almost zero downtime.
With nvim-dap-ui you can evaluate an expression by selecting it, and it would try to evaluate anything custom you do in the editor that wasn't in the original code.
`b line` and `expr expr` both work fine in lldb. I agree the ergonomics are less excellent, but that doesn't seem a reason to completely abandon lldb/gdb to me. Maybe I am missing something
If you're using IntelliJ, you can also right click the breakpoints and set conditions, or set a breakpoint to not suspend execution, but to activate another breakpoint so you can wait for a condition or line of code to be reached before the other breakpoint does anything. Super useful for debugging specific scenarios so you don't need to set up the context repeatedly.
Nice. I recently have been doing a bash deep dive and realizing that treating it like repl driven development is very useful. Been wondering if this is worth writing about for others.
You can also just execute another ‘bash’ process, of course the environment is a bit different
in (Common) Lisp it has been like that forever.
the debugger is just a REPL started in a peculiar environment that has e.g. some extra restarts registered by the error handler.
Sure, a 1980s debugger.
Modern debuggers have specialized capabilities way beyond the reach of REPLs.
Reverse debugging and debugging optimized programs come to mind.
Why couldn’t a sufficiently smart REPL have those things as well? Anything can happen after the read and around the execute stage!
A sufficiently smart anything can do anything.
What makes modern debuggers special is the insane amount of engineering to make it work.
LLDB is close to a thousand man years of engineering iirc.
Imagine if that man-millennium of engineering had been spent working on a decent language and ecosystem instead of C, C++ and Objective-C!
That’s what gets me: better languages are able to scrape by with several orders of magnitude less investment, precisely because they are better — but imagine how much more progress we as an industry would have made had we only invested a little more in those more promising ecosystems and a little less in the terrible ones.
> Modern debuggers have specialized capabilities way beyond the reach of REPLs.
Only if you are running on a machine with a full OS.
Embedded debugging is so bad that Microsoft forcing everybody to use DAP (Debug Adapter Protocol) was a step up.
It also doesn't help that compiler writers never met an optimization that they didn't like. It's often really hard to unwind optimized code back to something useful to probe. Sure, you can turn on debug optimizations but then your code runs an order of magnitude slower.
I'm curious what features you have in mind that you can't do from the Common LISP REPL?
Only if you ignore Smalltalk and Lisp environments.
There is still some catching up missing from other programming stacks.
What issues do the lisp and smalltalk repls make easier to debug ?
You can inspect any expression, break into the debugger mid-execution, change the code, whatever code you feel like, redo the execution after applying the changes for example.
The ultimate redo-eval-loop, with almost zero downtime.
They are Jupyter notebooks on steroids.
...and start another debugger on any expression(s) you like. This is a super-useful feature.
https://files.pharo.org/web-images/carousel/fusion.gif
Example:
https://cuis-smalltalk.github.io/TheCuisBook/The-Debugger.ht...
With nvim-dap-ui you can evaluate an expression by selecting it, and it would try to evaluate anything custom you do in the editor that wasn't in the original code.
Try something like this:
For running to the current cursor: Assign that to keys that you want.It works with gdb's DAP adapter.
`b line` and `expr expr` both work fine in lldb. I agree the ergonomics are less excellent, but that doesn't seem a reason to completely abandon lldb/gdb to me. Maybe I am missing something
If you're using IntelliJ, you can also right click the breakpoints and set conditions, or set a breakpoint to not suspend execution, but to activate another breakpoint so you can wait for a condition or line of code to be reached before the other breakpoint does anything. Super useful for debugging specific scenarios so you don't need to set up the context repeatedly.
When writing Python in VSCode you get a REPL when you hit a break point and I think that's sweet.
This isn't unique to vscode. It's standard in ides and clients of DAP for interpreted languages