aartaka / graven-image

Portability library for better interaction and debugging of a running Common Lisp image through text REPL.
BSD 3-Clause "New" or "Revised" License
19 stars 3 forks source link

Split into core and interactive systems #24

Open aartaka opened 1 year ago

aartaka commented 1 year ago

Now that I've made Trivial Toplevel Commands, the model of "always in debugger/inspector" that Allegro employs is quite tempting. Given this, custom command processors that Graven Image defines feel like a bleak parody of the real implementation REPLs. Might be useful to rewrite it with actual REPL commands.

But, to make that possible, Graven Image has to either:

Still, won't hurt to split the library into two separate components so that using core doesn't come with using opinionated (even if modeled after implementation-specific) inspect* etc.

This is not much of a problem, but it will become one when there's more interactive functions: ed*, step*, whatever.

fstamour commented 11 months ago

Could you explain a bit more what do you mean by the model of "always in debugger/inspector" that Allegro employs, for someone who never used Allegro?

aartaka commented 11 months ago

Sure.

  1. The standard requires (I'm not sure, but most implementations are suspiciously consistent in that regard) that debugger loop should be a full-blown REPL, akin to the toplevel one.
  2. In case of SBCL this debugger REPL is even more featureful than the toplevel one.
  3. Allegro goes a step further: it treats toplevel loop as a debugger/inspector one. So when you invoke inspect, Allegro simply sets a global variable and allows you to use toplevel commands like :istep to recurse into inspected object.
  4. Same for debugger. You can always print backtrace or inspect frames, even if you're outside debugger loop.

Which is pretty simple yet convenient—no need for custom REPLs (like inspect*), ability to act on on inspected/debugged state with the non-debugging commands etc. It's a powerful Idea that's worth exploring, I think.