On Sat, Jan 31, 2009 at 8:39 PM, Daniel Keep <[email protected]> wrote: > > > 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. > > $ int a = 42; > $ writefln("a = %s", a); > $ double a = 3.0; // rounded to 1 sf > > How would you write a prompt that does that with D? Either you store > each successive line in a source file and choke on the third one, or you > compile each line separately and choke on the second. > > Or you could examine each line to look for things like redefining of > symbols... but at that point you're half way to writing an interpreter > anyway. >
[/me discards half-written message saying the same thing half as well with twice as many words] *If* you could invoke the compiler as a library and have it return you a pointer to a freshly compiled function in memory somewhere, then you might have a shot and something that's a usable interactive prompt. Hmm compiler as a dll... sounds familiar. :-) --bb
