[m-dev.] for review: add mdb support for interactive queries

Peter Schachte schachte at cs.mu.OZ.AU
Wed Mar 17 10:59:56 AEDT 1999


On Mon, Mar 15, 1999 at 02:44:12PM +1100, Fergus Henderson wrote:

> That is, the default is that the interfaces of all modules in the program
> are visible; when you set a focus module, the interfaces of all modules
> are still visible, the only change is that you now also get access to
> the private parts of the focus module.

I just realized that I never explictly stated that I think all modules
should always be "used," it's only the actual *imports* that I think
should be changed by changing focus.  By trimming back the imports
when you set the focus module, you make it less likely that you will
have to module-qualify goals to avoid collisions.  But I guess it
would be ok if changing the focus module didn't change the imports, as
long as there's a way to "unimport" a particular module.


> 	$ vi foo.m				# write my program
> 	$ mmake foo.depend
> 	$ mmake libfoo.so			# compile it
> 	$ mdb
> 	mdb> load libfoo.so			# load it into the debugger
> 	mdb> query				# and run it
> 	?- foo(blah, blah, blah).		

It would be nice if mdb would invoke mmake as needed, so the
transcript could look more like

	$ emacs foo.m &				# write my program
	$ mdb foo
	... mmake messages ...
	mdb:  module `foo' has no main/2, entering query mode
 	?- foo(blah, blah, blah).		


> 	fail.					# oops, the code has a bug!
> 	?- ^D
> 	mdb> ^Z
> 	$ vi foo.m				# fix the bug
> 	$ mmake libfoo.so			# recompile
> 	$ fg
> 	mdb> load libfoo.so			# load in the new code
> 	mdb> query
> 	?- foo(blah, blah, blah).		
> 	true.					# this time it works ;-)

Of course, if you use emacs, you probably never left it, so there
would be no need to suspend mdb.  Thus if mdb invoked mmake as needed,
then the transcript could finish more like this:

	fail.					# oops, the code has a bug!
	... edit and save file ...
	?- ^D
	mdb> reload				# recompile and reload
	mdb> query
	?- foo(blah, blah, blah).		
	true.					# this time it works ;-)

Ideally, there would be a way to issue one-off debugger commands from
query mode (kind of like the @ command in Prolog debuggers, only
backwards).  Then it could look even better:

	fail.					# oops, the code has a bug!
	... edit and save file ...
	?- @reload.				# recompile and reload
	?- foo(blah, blah, blah).		
	true.					# this time it works ;-)


> I suppose it would also be useful to have a shell escape command in mdb,
> so that you can could do
> 
> 	mdb> shell vi foo.m
> 	mdb> shell mmake libfoo.so
> or 
> 	mdb> !vi foo.m
> 	mdb> !mmake libfoo.so

I like ! better.

> Also it might be nice if there was a single mdb command which would do
> all three commands
> 
> 	mdb> shell vi foo.m
> 	mdb> shell mmake libfoo.so
> 	mdb> load libfoo.so

Nah, skip invoking the editor, just have it rebuild and reload.  If
you have it rebuild everything that's loaded that needs to be rebuilt,
that gives you the nice, simple reload command.

> Then it's just a matter of wrapping a nice GUI around all this,
> and changing the name & prompt from "mdb" (Mercury Debugger)
> to "mde" (Mercury Development Environment) ;-)

... or maybe `mercury'.  Sounds good to me.  I guess a good Mercury
IDE is closer than I thought.  It's all SMOP now.

-- 
Peter Schachte                     Don't worry about people stealing your
mailto:schachte at cs.mu.OZ.AU        ideas. If your ideas are any good, you'll
http://www.cs.mu.oz.au/~schachte/  have to ram them down people's throats.
PGP: finger schachte at 128.250.37.3      -- Howard Aiken 



More information about the developers mailing list