Calling an arbitrary predicate from mdb

Fergus Henderson fjh at cs.mu.OZ.AU
Tue Dec 1 22:10:00 AEDT 1998


On 30-Nov-1998, Bert Thompson <aet at cs.mu.OZ.AU> wrote:
> Fergus,
> 
> Is there any simple way to call an arbitrary predicate from the mdb?

No, not yet.

Note that for safety any such facility for calling *arbitrary* predicates
ideally ought to do type and mode checking to ensure that the call is safe.

> I'm looking into a debugger scripting language, and it seems much easier
> simply to call a pre-written Mercury predicate in order to display
> a data structure.
> 
> Printing a map implemented with a tree234 structure, for example,
> is difficult to do using a scripting language, since the concrete
> representation is what the browser currently is presented with,
> not the abstraction provided by the map interface.
> 
> The simpler solution therefore, is to link with a library of
> preds for displaying data structures from the library. Any user-defined
> display preds could also be loaded in, possibly dynamically.
> 
> I will mandate that such display predicates use fixed type and mode signatures.

That's a good idea.

> Something like browse.browse:
> 	display_pred(PolymorphicObject, BrowserStateIn, BrowserStateOut).
> 
> Ideally, you should be able to load and unload a Mercury-compiled
> shared object from the debugger commandline also.
> 
> Let me know if you have any ideas, otherwise I'll just do this.

What you propose sounds good to me.

-- 
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