[m-dev.] for review: add exception__try_store
Fergus Henderson
fjh at cs.mu.OZ.AU
Thu Feb 22 17:40:36 AEDT 2001
On 22-Feb-2001, Mark Anthony BROWN <dougl at cs.mu.OZ.AU> wrote:
> > -:- pred get_determinism_2(pred(T, io__state, io__state), determinism).
> > +:- pred get_determinism_2(pred(T, S, S), determinism).
> > :- mode get_determinism_2(pred(out, di, uo) is det, out(bound(det)))
> > is cc_multi.
> > :- mode get_determinism_2(pred(out, di, uo) is cc_multi, out(bound(cc_multi)))
>
> The spacing of the mode declarations was such that the mode of the second
> argument lined up with the type, to make it easier to read. This is no
> longer the case, so it would be good if you could either fix or remove the
> extra space.
I'll add extra spaces to make it line up.
> > +% In other words, with a naive implementation of `try_store',
> > +% the following program could print out
> > +%
> > +% Result = exception(initial)
> > +% Result = exception(updated)
>
> That's not exactly what could be printed out, although it is clear what
> you mean.
I'll fix that (it should be `exception(univ_cons(initial))' and likewise
for `updated').
> > +main -->
> > + { store__new(Store0) },
> > + { store__new_ref(mklist("initial"), Key, Store0, Store1) },
> > + { store__arg_ref(Key, 0, SubKey, Store1, Store2) },
> > + { exception__try_store(tricky(Key), Result, Store2, Store3) },
> > + print("Result = "), print(Result), nl,
> > + { store__set_ref_value(SubKey, "updated", Store3, Store) },
> > + print("Result = "), print(Result), nl,
> > + { store__extract_ref_value(Store, Key, Val) },
> > + print("Val = "), print(Val), nl.
>
> The call to set_ref_value might be reordered after the following calls
> to print, which means that this test case could pass even if try_store
> does not do the right thing.
Sure. But in general test cases can only ever show the presence of bugs,
not their absence. In other words, I think it's OK as is ;-)
If you have a particular suggestion about how it could be improved
I'll certainly consider it.
--
Fergus Henderson <fjh at cs.mu.oz.au> | "I have always known that the pursuit
| of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh> | -- the last words of T. S. Garp.
--------------------------------------------------------------------------
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