[m-dev.] for review: add mdb support for interactive queries
Fergus Henderson
fjh at cs.mu.OZ.AU
Thu Mar 4 12:02:58 AEDT 1999
On 04-Mar-1999, Peter Schachte <schachte at cs.mu.OZ.AU> wrote:
>
> ... the documentation doesn't discuss this, and I confess I haven't
> looked at the code, but I assume that you can't interactively call a
> predicate/function which is not exported from its module. Is that
> right?
Yes.
> If so, I think that should be explicitly mentioned here,
> because Prolog programmers will expect it and waste time trying to
> figure out how to do it.
Shall do.
> Also, for white box testing it would be very useful to be able to
> somehow call non-exported predicates. (Assuming it's not possible
> now) I think it should be a wish-list item for the debugger to support
> that.
This is probably not too hard to implement -- much of the work has already
been done for nested modules. If you want your query to use symbols
in the implementation of module `foo', then the system should compile
it to a nested module `foo.query.m'. Currently the compiler *doesn't*
check that foo.query.m is really declared to be a submodule of `foo',
so the following patch is the only change currently required to the
compiler. However, some changes to the debugger will be required.
There needs to be some way of saying which module you want to
nest the query in. Any suggestions on the user interface?
Index: modules.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/modules.m,v
retrieving revision 1.96
diff -u -u -r1.96 modules.m
--- modules.m 1999/02/09 00:27:44 1.96
+++ modules.m 1999/03/04 00:47:08
@@ -1037,12 +1037,22 @@
PublicChildren, FactDeps, Module0) },
% If this module has any seperately-compiled sub-modules,
- % then we need to make everything in this module
+ % or if debugging (in particular interactive queries)
+ % is enabled, then we need to make everything in this module
% exported_to_submodules. We do that by splitting
% out the declarations and putting them in a special
% `:- private_interface' section.
- { get_children(Items0, Children) },
- { Children = [] ->
+ %
+ % Currently we use the require_tracing option (which is
+ % implied by --debug) to determine whether to always export
+ % everything. But perhaps we should create a new option
+ % specifically for this purpose?
+ io__lookup_bool_option(require_tracing, MustExportEverything),
+ {
+ MustExportEverything = no,
+ get_children(Items0, Children),
+ Children = []
+ ->
Module1 = Module0
;
split_clauses_and_decls(Items0, Clauses, Decls),
--
Fergus Henderson <fjh at cs.mu.oz.au> | "Binaries may die
WWW: <http://www.cs.mu.oz.au/~fjh> | but source code lives forever"
PGP: finger fjh at 128.250.37.3 | -- leaked Microsoft memo.
More information about the developers
mailing list