Zulip Chat Archive

Stream: mathlib4

Topic: Cleaning up error messages with the new string gaps feature


Kyle Miller (Dec 23 2023 at 15:49):

I've gone through mathlib looking for error messages that span multiple lines and cleaned them up using the "string gap" escape sequence feature that's now in Lean. #9193

This feature lets us write

    logError m!"\
      After careful consideration, tactic \
      cannot apply{indentD e}\n\
      due to some reason or another."

rather than something like

    logError m!"After careful consideration, tactic {
      ""}cannot apply{indentD e
      }\ndue to some reason or another."

This sort of cleanup has already been done in std4#480

Kyle Miller (Dec 23 2023 at 15:51):

I'm mentioning this here mostly as a PSA for metaprogrammers -- no need to be clever with {...} anymore!

Eric Wieser (Dec 23 2023 at 16:14):

The red boxes in the snippet raise that we should probably upstream our lean4 pygments highlighter so that Zulip has access to it

Eric Wieser (Dec 23 2023 at 16:14):

(possibly after rewriting it to use the fixes that have been made upstream to the lean3 one in the meantime; for instance, https://github.com/pygments/pygments/pull/2614)

Eric Wieser (Dec 30 2023 at 19:50):

Done in https://github.com/pygments/pygments/pull/2618


Last updated: May 02 2025 at 03:31 UTC