Walter Bright Wrote: > Bill Baxter wrote: > > Having to recompile and rerun after every one of those changes just > > isn't quite as direct. > > If it can be done in under half a second, isn't that direct enough? Of > course, I'm talking about a shell that does it for you.
If anybody is really serious about doing this they might want to look at the implementation of a similar shell for C at http://neugierig.org/software/c-repl/. Oddly much of it is written in Haskell, but there's also an early Ruby prototype that might be useful. Essentially each line is wrapped in a function, compiled into a library and then dlopen'ed in the parent process and executed. Assignments are translated into globals. This will be a little more complex in D because there isn't one global namespace. Actually I think this has been brought up on this list before, I can't find the original reference though.