[mercury-users] Strange Error Message

Gustavo A. Ospina gos at info.ucl.ac.be
Wed Aug 1 01:16:08 AEST 2001


Thanks to Fergus, effectively the ambiguity problem is in the '!' 
character which was confused with the '!'/0 predicate. I could have used 
the predicate io__write_char instead.

> It's better to use `__' rather than `:' as the module qualifier.
> The plan is to make `.' the module qualifier and `:' the type
> qualifier at some point in the future.

Thanks. I thought ':' was to be the new module qualifier, so I was 
trying to adapt my code to that.

> Just as a point of style, you might find this easier to read:
> 
> print_pred_call(Stream, cut) -->
> 	io__format(Stream, "!", []).
> 
> print_pred_call(Stream, unif(Var, Expr)) -->
> 	io__format(Stream, "%s = %s", [s(Var),
> s(expr_to_string(Expr))]).
> 
> print_pred_call(Stream, pred_call(P, Exprs)) -->
> 	io__format(Stream, "%s(%s)", [s(P), s(exprs_to_string(Exprs)]).

I think this would be closer to my prolog style of coding. When I 
program in Prolog, I write always separate clauses. In Mercury I write 
just a clause with explicit switches instead. I can read both styles.

> and replace print_expr with expr_to_string etc.

That's a good idea, as well as the use of io__format.

> Have you got predicates with any of the same names as your constructors
> (cut, unif, pred_call) in scope?

No, it was my confusion.

Thanks again,

+ Gustavo +
--------------------------------------------------------------------------
mercury-users mailing list
post:  mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the users mailing list