[m-dev.] diff: use pretty printer in mdb

Mark Anthony BROWN dougl at cs.mu.OZ.AU
Tue May 23 05:10:35 AEST 2000

Ralph Becket writes:
> > -----Original Message-----
> > From: Mark Anthony BROWN [mailto:dougl at cs.mu.OZ.AU]
> > Sent: 22 May 2000 07:46
> >
> > [...]
> > +% Print using the pretty printer from the standard library.
> > +% XXX the size of the term is not limited---the pretty printer
> > +% provides no way of doing this.
> In what sense are you using `size' here?

The number of functors in the term.  If there is a large branching
factor in the displayed term, and the depth limit is not low enough,
then a ridiculously large term might still be displayed.  The browser
avoided this by keeping track of the number of functors, and displaying
an ellipsis when the maximum size was reached.

This measure is still used by other parts of the browser (which did
not appear in the diff).

>  The existing code (which
> will go horribly wrong on very large terms [performance bug - a 
> fix is in the pipeline]) allows you to specify the depth to which
> pretty printing will go - as you've made provision for - and it
> allows you to specify the notional display width (which it will
> overrun if that cannot be avoided).
> Do you mean that you'd like pprint to have a facility to clip
> output to a given n x m character cell window?  If so, something
> like that could probably be arranged.

That would be great.  Anything that puts reasonable limits on the
number of lines displayed would be fine.

As for the performance problem, I think it can be solved by threading
the available width through flatten, which should fail if there is not
enough room for the flattened document.  This will allow the 
condition (in be/3) to fail before the recursive call.

If this sounds like the right way to go, I'll test out the idea and
post a diff soon.  Comments, anyone?


mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au

More information about the developers mailing list