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

Julien Fischer jfischer at opturion.com
Wed Oct 12 14:45:37 AEDT 2022



On Wed, 12 Oct 2022, Zoltan Somogyi wrote:

>
>
> 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?

Yes, I think that's a better approach.

Julien.


More information about the reviews mailing list