Giter Site home page Giter Site logo

Comments (9)

nomeata avatar nomeata commented on July 19, 2024

I am unsure. If a user is faced with this error message they might really need this help to identify the respective calls, and so far I did not think of a better way. Do you?

I assume it bother you in the context of tests? Happy to accept a PR that adds an option to omit them, similar to pp.mvars, that people writing tests with these can turn on.

from lean4.

Seasawher avatar Seasawher commented on July 19, 2024

I assume it bother you in the context of tests?

Yes. When writing code to test output messages, the test code must be modified frequently each time the file is changed.

from lean4.

nomeata avatar nomeata commented on July 19, 2024

Got it. What is your use case for testing failing function definitions? The lean test suite itself, or some other project?

You could also test it indirectly: use guard_msgs to hide the error text, and then afterwards check that the function is not fully constructed (e.g. no .eq_def lemma)

from lean4.

Seasawher avatar Seasawher commented on July 19, 2024

I'm writing Lean reference book (https://lean-ja.github.io/lean-by-example/, Japanese) and I use #guard_msgs to show examples including errors without actual error.

from lean4.

Seasawher avatar Seasawher commented on July 19, 2024

You could also test it indirectly: use guard_msgs to hide the error text, and then afterwards check that the function is not fully constructed (e.g. no .eq_def lemma)

oh nice! it is interesting

#guard_msgs (drop all) in
def alternate {α : Type} (xs ys : List α) : List α :=
  match xs, ys with
  | [], ys => ys
  | x :: xs, ys => x :: alternate ys xs

/-
alternate [1, 2] [3, 4]
-/
#reduce alternate [1, 2] [3, 4]

from lean4.

nomeata avatar nomeata commented on July 19, 2024

I'm writing Lean reference book (https://lean-ja.github.io/lean-by-example/, Japanese) and I use #guard_msgs to show examples including errors without actual error.

That's great work, thanks! But hopefully you understand that this is a special case and shouldn't guide the error message phrasing.

Are you unblocked by the drop all trick? Can we close this then?

from lean4.

Seasawher avatar Seasawher commented on July 19, 2024

Are you unblocked by the drop all trick?

No. I would be happy to be able to display the error message itself, so I would still be happy if there was a way to remove the specific line number from the error message.

from lean4.

Seasawher avatar Seasawher commented on July 19, 2024

But hopefully you understand that this is a special case and shouldn't guide the error message phrasing.

Ok this is reasonable. You can close this as not planned.
I may be able to achieve what I want to do in the future by using verso or some other method.

from lean4.

david-christiansen avatar david-christiansen commented on July 19, 2024

This is plausible - in Verso, it would be fairly easy to write a program that checked Lean messages for equality modulo substrings that look like source positions and/or metavariable names, so the error in the book matches what users will see but it doesn't need updating quite so often.

from lean4.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.