[m-dev.] [m-users.] Mercury with Guile

Zoltan Somogyi zoltan.somogyi at runbox.com
Thu Aug 14 08:21:50 AEST 2014



On Wed, 13 Aug 2014 22:29:50 +0200, "Tomas By" <tomas at basun.net> wrote:
> Have wasted an hour now trying to figure out some really weird type
> inferences, when the problem was I hadn't imported the "pair" module.

(a) We always try to make our error messages easy to comprehend.
However, I hope you know that the phrase "really weird type inferences",
without the actual error messages or the source code that generated them,
is not a useful bug report.

(b) If the compiler were modified to know about modules that the program
being compiled did not import, and reference them in error messages when
it thought appropriate, it would not only tell you "you did not import pair.m"
in situations such as the one you mention; it would also tell you "you did not
import xyz.m" in some situations where xyz.m has nothing to do with the
actual problem.

(c) We have found it a good idea to define purpose-specific types even
when these are isomorphic to one of the standard Mercury library types,
such as pair or bool. Not only does this make any error messages about
the code that uses these types easier to understand (since it avoids any
possibility of mistaking their function symbols as coming from another type),
it also makes the code clearer to other readers, and thus easier to maintain,
and even to get right in the first place.

Zoltan.



More information about the developers mailing list