[m-users.] Uncaught exception

Julien Fischer jfischer at opturion.com
Wed Apr 16 13:44:43 AEST 2014


On Wed, 16 Apr 2014, Peter Berry wrote:

> Sometimes I try developing a new predicate starting with a clause
> "head(Args) :- fail.", then add actual code under it when I get round
> to that case.

An alternative to that is to add just the predicate declaration and
compile with --allow-stubs enabled.  (That way the compiler won't
generate determinism errors for code that calls stub predicates and will
also tell you what stub predicates are yet to be implemented.)

> If I forget to remove the "fail.", mmc gets confused as
> it thinks it's looking at a definition of ,/2:
> :- module test.
> :- interface.
> :- pred test is det.
> :- implementation.
> test :- fail.
>     test,
>     test,
>     test.
> /*
> pwb at rhuidean /tmp $ mmc -c test.m
> Uncaught Mercury exception:
> Software Error: hlds.pred_table: predicate `hlds.pred_table.get_proc_id'/3: Unexpected: cannot take address of pred
> `,/2' with no modes.
> (Sorry, confused by earlier errors -- bailing out.)
> */

It's annoying that the message doesn't give you a hint *where* the
problem is.  I'll take a look at it and see if we can generate somthing
more useful.


More information about the users mailing list