[m-dev.] Re: Calling an arbitrary predicate from mdb

Tyson Dowd trd at cs.mu.OZ.AU
Tue Dec 1 23:27:28 AEDT 1998


On 01-Dec-1998, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> On 30-Nov-1998, Bert Thompson <aet at cs.mu.OZ.AU> wrote:
> > 
> > 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.

The difficult part is that you need to keep a list of all the display
preds available, despite the fact that they are defined in different
modules.

One way to do this is to have some sort of pragma declaration that
adds some initialization code to the initialization section of the
module that registers each display predicate -- putting them into
some sort of global table.

You can then just use the type of the data structure you are browsing
to lookup in the table and see if you have a predicate that matches the
type you are looking for.


> > 
> > I will mandate that such display predicates use fixed type and mode signatures.
> 
> That's a good idea.

Yep, that will help immensely.

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

Yes, well, as discussed at the Mercury meeting today this is a big
step for a rather small functionality gain.  There are lots of
issues to resolve in both language semantics and technical trickery.

So unless this is a fairly simple thing to implement, I wouldn't worry
about it just yet.

-- 

Because I dislike being quoted I lie almost constantly when talking 
about my work.
		-- Terry Gilliam

Tyson Dowd   <tyson at tyse.net>   http://tyse.net/




More information about the developers mailing list