[slim-vim] REPL and debugging

Jim Bailey dgym.bailey at gmail.com
Tue Mar 21 07:10:45 CST 2006


On Mon, 20 Mar 2006 22:19:10 -0500
Larry Clapp <larry at theclapp.org> wrote:
<snip>
> 
> > It is a shame about the debugger not being able to recursive edit
> > because vim has no support.
> 
> Yeah.  I've taken a look at the main_loop function, and it seems to
> use global variables just out the wazoo.  Maybe we could create a
> struct, put all the globals in it, and change all the global accesses
> to use access functions instead, which would look at whatever struct
> was active.  Look, ma, dynamic variables!  Greenspunning at its
> finest.  But hey, it might work.

I have though of a way to add recursive edit-style debugging. Since vim
isn't expecting to be used that way (mmmmmm globals), and ecl uses c's
stack so call-with-current-continuation can't be added easily, we could
just go mad and use our very own separate stack for ecl, like the one
you get free with every thread.

By running ecl in a separate thread all the state handling logic gets
written in lisp, which is nice. The debug loop can run with the stack
wound up to support introspection and restarts and the like, and this
can be made reentrant for multiple debug levels.

The only problems I see with this is that not all platforms have
threads, and I don't like using threads if it all possible. It would
certainly be a shame to mandate threads for any use of vim+ecl, so as
long as it is only used when really needed, like for a really nice
REPL, and slim-vim windows then its probably a good thing to go this
route rather than sacrifice functionality.

I am still going to add type checking before I do anything else, but
then I will take a look into threading, and locking and all that good
stuff.

> Interesting.  You translated the Vim verbatim.  We should look at
> whether Vim actually sets VIMRUNTIME in the C environment area, and
> use that if it exists.

Going the direct route is nice and everything, but I hadn't had a
chance to code for so long I just had to write an s-expression :) Yeah,
it should change.

Cheers,
dgym


More information about the slim-vim mailing list