[m-users.] A question of style...

Zoltan Somogyi zoltan.somogyi at runbox.com
Thu Mar 3 15:25:02 AEDT 2022

2022-03-01 20:01 GMT+11:00 "Sean Charles (emacstheviking)" <objitsu at gmail.com>:
> I guess what I am trying to ask is, is there a 'Mercury Way' to handling this.

There is no single standard way of handling this.

The Mercury compiler tries to give meaningful diagnostics for each kind of error,
so in most such cases we write stair-case code, because that allows us to generate
different error messages for different kinds of errors. The stair-case effect has not been
a problem since we switched from eight space to four space indentation ages ago,
because this allows pretty much even the deepest of our staircases to fit on a
standard 80-column line.

But there are other ways of handling this problem, and some other parts of the
Mercury system, which don't have the same need to generate failure-kind-specific
error messages, do use them. See for example io_combinator.m in the deep_profiler
directory, as well as both of the techniques you cite.

Which one you use in depends on your taste as well as the demands of the circumstances.


More information about the users mailing list