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

Peter Schachte schachte at cs.mu.OZ.AU
Thu Mar 11 11:21:34 AEDT 1999


On Thu, Mar 11, 1999 at 05:26:38AM +1100, Fergus Henderson wrote:
> On 05-Mar-1999, Peter Schachte <schachte at cs.mu.OZ.AU> wrote:
> > On Fri, Mar 05, 1999 at 05:06:17AM +1100, Fergus Henderson wrote:
> > > You can have module-qualified predicate calls, but then what
> > > do we do about goals such as `?- m1:foo, m2:bar.'?
> > 
> > I assume you mean when neither foo nor bar is exported from its
> > module?  Not much you can do with this implementation technique, is
> > there?
> 
> No.
> 
> Do you have any suggestions about what the user interface should be,
> presuming that we stick with this implementation technique
> (treating the query as a nested module)?

Hmmmmm.  What I proposed was basically the Quintus Prolog debugger
model.  As I think about it, due to Mercury's overloading facilities
another model seems better to me.  How about a model in which when
you're debugging, it's as if you've implicitly imported every module in
the application?  Whenever there's a conflict, you can explicitly
module-qualify the goal.

When you're debugging a particular module, however, you are probably
not interested in any modules other than the one you're debugging, the
ones it imports, the ones they import, and so on. For such cases, it
would be useful to focus on a particular module, and thereby limit
visibility to modules recursively imported by the focus module.

How does that model sound?

In terms of implementation, do you have access to the list of modules
recursively imported by a given module?  Even if you just have access
to the list of modules imported by each module, the transitive closure
should be easy enough to code.  If that works, you can just bundle
queries into a submodule of the current focus module, into which you
import all the focus module's recursive imports.

If you don't have access to module import information, and if it's too
much work to save it in the object code of debuggable modules
somewhere, then I guess you have to get the user to tell you this.  As
I understand it, that's what you're currently doing.  But you can
still use the focus module to indicate which module to nest the query
in; ie, which module the query will be able to call unexported
predicates in.

So really all you have to do is add a debugger command to set the
focus module, and always nest queries within that.  Maybe also a
command to reset it to the default: the root module of the
application.

-- 
Peter Schachte                     Do, or do not. There is no 'try'.
mailto:schachte at cs.mu.OZ.AU            -- Yoda ('The Empire Strikes Back') 
http://www.cs.mu.oz.au/~schachte/  
PGP: finger schachte at 128.250.37.3  



More information about the developers mailing list