Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: message kinds #5945

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

feat: message kinds #5945

wants to merge 5 commits into from

Conversation

tydeu
Copy link
Member

@tydeu tydeu commented Nov 4, 2024

Adds a new definition Message.kind which returns the top-level tag of a message. This is serialized as the new field kind in SerialMessaege so that i can be used by external consumers (e.g., Lake) to identify messages via lean --json.

The tag of trace messages has also been changed from _traceMsg to the more friendly trace.

@tydeu tydeu marked this pull request as draft November 4, 2024 16:40
@github-actions github-actions bot added the toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN label Nov 4, 2024
leanprover-community-mathlib4-bot added a commit to leanprover-community/batteries that referenced this pull request Nov 4, 2024
leanprover-community-mathlib4-bot added a commit to leanprover-community/mathlib4 that referenced this pull request Nov 4, 2024
@leanprover-community-bot leanprover-community-bot added the builds-mathlib CI has verified that Mathlib builds against this PR label Nov 4, 2024
@leanprover-community-bot
Copy link
Collaborator

leanprover-community-bot commented Nov 4, 2024

Mathlib CI status (docs):

leanprover-community-mathlib4-bot added a commit to leanprover-community/batteries that referenced this pull request Nov 4, 2024
leanprover-community-mathlib4-bot added a commit to leanprover-community/mathlib4 that referenced this pull request Nov 4, 2024
@tydeu
Copy link
Member Author

tydeu commented Nov 4, 2024

This is the first step for a potential solution to #5194. An alternative solution would be to collect all tags within a message and serialize them. However, as the goal here is to be able to identify messages by name to customize reporting, it is not clear how this would work in a multiple tag case. Hence, the approach here is restricted to a single "message kind". A tags field can be added in the future should a more appropriate use case emerge.

@tydeu tydeu marked this pull request as ready for review November 4, 2024 19:50
@tydeu tydeu requested a review from Kha November 4, 2024 19:50
@Kha
Copy link
Member

Kha commented Nov 5, 2024

If it's always inferred, why is it a field?

@tydeu
Copy link
Member Author

tydeu commented Nov 5, 2024

@Kha It is a field so that it will be part of SerialMessage (where it is not inferred since data is a String), and also thus a part of the JSON output. This solution seemed less disruptive than the alternative of different structures for Message and SerialMessage.

@Kha
Copy link
Member

Kha commented Nov 6, 2024

Oh you mean it is there for deriving ToJson. I don't love that it can't be defaulted. What would be disruptive about putting it in SerialMessage, can't we make it a structure extending BaseMessage String?

@tydeu
Copy link
Member Author

tydeu commented Nov 6, 2024

@Kha

What would be disruptive about putting it in SerialMessage, can't we make it a structure extending BaseMessage String?

Good idea! For some reason it did not occur to me that SerialMessage could be written that way. (I was too stuck on them both needing to be BaseMessage α for some α.)

Separately, the odd JSON encoding of a anonymous kind has led me to propose #5980.

leanprover-community-mathlib4-bot added a commit to leanprover-community/batteries that referenced this pull request Nov 6, 2024
leanprover-community-mathlib4-bot added a commit to leanprover-community/mathlib4 that referenced this pull request Nov 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
builds-mathlib CI has verified that Mathlib builds against this PR toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants