[m-dev.] Re: for review: add parsing/storing of assertions

Zoltan Somogyi zs at cs.mu.OZ.AU
Wed Jul 21 10:16:33 AEST 1999


There is another problem with runtime checking of assertions (pre- and post-
conditions as well as exclusive and exhaustive assertions) that I haven't
seen raised so far. This is that a large fraction (probably a significant
majority) of the assertions that programmers would want to write are
recursive. The precondition of a merge algorithm would be that the inputs
are sorted, which is linear in the lengths of the lists; checking the
precondition at each call would turn a linear merge algorithm into a
quadratic one. I think a straightforward approach to the checking of
assertions will introduce similar or worse slowdowns in sufficiently many
cases to piss off programmers.

Clearly, what is needed is a way of checking assertions incrementally;
i.e. checking only the part that other, recursive invocations of the same
assertion will not check. This is doable (there have been algorithms designed
to incrementally evaluate integrity constraints in databases that could
probably be adapted, or mined for ideas), but it is not trivial.

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