[m-rev.] for review: simplify some code in error_util.m

Zoltan Somogyi zoltan.somogyi at runbox.com
Wed Oct 12 14:41:04 AEDT 2022



On Wed, 12 Oct 2022 14:26:37 +1100 (AEDT), Julien Fischer <jfischer at opturion.com> wrote:
> Why not just introduce new format components, e.g. collapsible_lparen
> and collapsible_rparen, that do what you want?  That seems as though
> it would avoid a bunch of fiddly string manipulation, which encoding
> the structure using non-printable characters would not.

That was my first thought as well, but it has a significant problem,
which is that error_util.m converts format_components to just plain strings
*before* information about how much fits on a line becomes available.
It *has* to, because what words fit on a line depends on how many
characters the word contains. We *could* change this process to
keep some indications of some format_components, such as
collapsible parens, around with the strings, but that would effectively be
just a more complex version of the scheme I outlined.

But we *could* arrange things so that

- users write collapsible_[lr]paren format_components instead of ( and ),
- have write_error_spec's implementation convert these to the non-printable
  characters during the conversion to paragraph form,
- and then the rest of that implementation work as in my previous email.

I think that would be a good idea. Do you agree?

Zoltan.





More information about the reviews mailing list