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

Synterp code of creating notations unnecessarily uses notation's body #18943

Open
trilis opened this issue Apr 17, 2024 · 2 comments
Open

Synterp code of creating notations unnecessarily uses notation's body #18943

trilis opened this issue Apr 17, 2024 · 2 comments
Labels
kind: wish Feature or enhancement requests.

Comments

@trilis
Copy link
Contributor

trilis commented Apr 17, 2024

Refactoring request

It seems strange to me that to call synterp part of creating notations (Metasyntax.add_notation_syntax), I need to pass notation body as the part of notation_declaration structure (ntn_decl_interp field — it even has interp in its name :) ). Inspecting the code, I came to conclusion that the only place where the body is actually used is changing the term in case of infix notations. I suppose that infix flag can be remembered for interp code, and interp code can change the term however it likes.

Additional context

The context here is that I want to add to coq-elpi (cc @gares) builtins for creating notations (it currently has API for abbreviations, but we need full-blown notations with custom scopes, levels, etc). For our elpi fork, we just use placeholder Constrexpr.CHole (None) in synterp code and then call add_notation_syntax again in interp code, this time with the actual body. It works (as we don't use infix notations), but I want a prettier solution before submitting PR to public elpi.

@trilis trilis added kind: wish Feature or enhancement requests. needs: triage The validity of this issue needs to be checked, or the issue itself updated. labels Apr 17, 2024
@trilis trilis changed the title Synterp code of Synterp code of creating notations unnecessarily uses its body Apr 17, 2024
@trilis trilis changed the title Synterp code of creating notations unnecessarily uses its body Synterp code of creating notations unnecessarily uses notation's body Apr 17, 2024
@SkySkimmer
Copy link
Contributor

I suppose that infix flag can be remembered for interp code, and interp code can change the term however it likes.

Sounds reasonable. Do you intend to try to make this change or are you asking for someone else to do it?

@trilis
Copy link
Contributor Author

trilis commented Apr 17, 2024

Sure, I can try in the next couple of days. I will need some help with adapting external plugins and libs to this change though, as I have no idea how adapting process works in the coq community

@SkySkimmer SkySkimmer removed the needs: triage The validity of this issue needs to be checked, or the issue itself updated. label Apr 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: wish Feature or enhancement requests.
Projects
None yet
Development

No branches or pull requests

2 participants