[m-rev.] for review: colour in error messages

Zoltan Somogyi zoltan.somogyi at runbox.com
Wed Apr 24 18:26:36 AEST 2024


For review by anyone. The capability is disabled for now,
but the attached two .err files show what the output looks like.
(Those were generated by a version of mmc in which I enabled
the capability.)

There are several questions raised by this diff.

1. Programmers should be able to enable or disable colour.
Once we have robust suport for it, which should be the default?
What should be the name of the option that controls it?
Something like --enable-colo{u}r?

2. Programmers who enable colour should be able to control
the actual colours used. What should the option names be?
--set-correct-colo{u}r-to 45?

3. Should we support something beyond 8-bit color (such as that 45)?
I have no idea how widespread the support for 24 bit rgb is in terminals
(as opposed to actual display devices).

If so, what should the option names be?

4. How should we test this capability? We could pick a standard
set of colours (the default set should work) and update the .err_exp
files to contain the resulting terminal escape sequences. Or we could
add the expected .err files with the escape sequences as new .err_exp2 files,
leaving the original .err_exp file without those sequences.
Neither of those would enable us consistently keep testing error messages
both with colour enabled and with colour disabled.

We could design a mechanism for executing each test case in invalid* and
in warning with color both enabled and disabled, with a separate set of
.err_exp files for each case.

5. At the moment, the diff supports two colours, intended for correct
and incorrect code respectively. In error messsages of the form
"expected x, got y", the intention is that x would be in the correct colour,
and the y in the incorrect colour.

Should we have a separate logical colour for "this may be caused by"
messages? If so, what should be the default actual colour?

6. The bike-shed question: it is clear that option names should have
two versions, one with "color" and one with "colour", but which spelling
we should use internally? The american version is slightly less likely to cause
a line to be too long, but graph_colour.m and set_of_var.m use brit spelling.

Zoltan.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Log.color
Type: application/octet-stream
Size: 2593 bytes
Desc: not available
URL: <http://lists.mercurylang.org/archives/reviews/attachments/20240424/c8e9e3c3/attachment-0004.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: DIFF.color
Type: application/octet-stream
Size: 48446 bytes
Desc: not available
URL: <http://lists.mercurylang.org/archives/reviews/attachments/20240424/c8e9e3c3/attachment-0005.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: subtype_order.err
Type: application/octet-stream
Size: 770 bytes
Desc: not available
URL: <http://lists.mercurylang.org/archives/reviews/attachments/20240424/c8e9e3c3/attachment-0006.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: inconsistent_pred_order.err
Type: application/octet-stream
Size: 1082 bytes
Desc: not available
URL: <http://lists.mercurylang.org/archives/reviews/attachments/20240424/c8e9e3c3/attachment-0007.obj>


More information about the reviews mailing list