[m-dev.] Adding default clauses to the language.
Holger Krug
hkrug at rationalizer.com
Thu Aug 9 22:29:33 AEST 2001
On Thu, Aug 09, 2001 at 09:48:11PM +1000, Peter Schachte wrote:
> On Thu, Aug 09, 2001 at 09:15:09PM +1000, Fergus Henderson wrote:
> > :- func detmap3(func(T1, T2, T3) = T, list(T1), list(T2), list(T3)) = list(T).
> > :- never_fails detmap3(in, in, in) = out.
> I think it's probably going to be necessary in practice to explicitly
> specify the exception to throw instead of failing.
>
> Quibble: I don't think "never_fails" is a good name for it. It sounds like
> it says this predicate called in this mode can't fail. But the mode
> declaration already says that (or is this in place of the mode
> declaration?). Anyway, what it really says is "in this mode, modify my code
> so that if it would fail, instead raise an exception." Maybe "never_fail"
> or "ensure_no_failure" or "error_on_failure" would be better a name?
Maybe:
:- failing detmap3(in, in, in) = out throws Exc.
or:
:- mode detmap3(in, in, in) = out is det ; throws Exc.
`Exc' could even be an expression, but then one would have to handle the
case if `Exc' throws an exception.
--
Holger Krug
hkrug at rationalizer.com
--------------------------------------------------------------------------
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