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

Ability to return values from Ltac2 to Ltac1 is not documented #18122

Closed
RalfJung opened this issue Oct 3, 2023 · 7 comments
Closed

Ability to return values from Ltac2 to Ltac1 is not documented #18122

RalfJung opened this issue Oct 3, 2023 · 7 comments

Comments

@RalfJung
Copy link
Contributor

RalfJung commented Oct 3, 2023

Description of the problem

Currently, ltac2:(...) quotations only accept terms that return (). Any time data needs to be passed from ltac2 to ltac1, one has to write things in continuation-passing style, which can require major refactoring of existing code and makes gradual migration a lot harder.

It would be great if there was a way to directly return values of type Ltac1.t from ltac2 to ltac1.

Cc @robbertkrebbers

Coq Version

8.18.0

@SkySkimmer
Copy link
Contributor

8.18 should have ltac2val:() #17575

@robbertkrebbers
Copy link
Contributor

What's the reason we need a special ltac2val: for that. Why cannot ltac2: be generalized to also support value-returning tactics?

@RalfJung
Copy link
Contributor Author

RalfJung commented Oct 3, 2023

Ah, I seemed to remember that there was some improvement here but https://coq.inria.fr/refman/proof-engine/ltac2.html?highlight=ltac2#compatibility-layer-with-ltac1 doesn't mention ltac2val so I didn't find it.

What's the reason we need a special ltac2val: for that. Why cannot ltac2: be generalized to also support value-returning tactics?

I guess it is similar to the "tactic must either have side-effects or return a value but not both" restriction? Though that can be worked-around with match goal so it's not really water-tight, and I never understood where this limitation comes from either.

@SkySkimmer
Copy link
Contributor

What's the reason we need a special ltac2val: for that. Why cannot ltac2: be generalized to also support value-returning tactics?

@ppedrot didn't want it #17575 (comment)

@RalfJung
Copy link
Contributor Author

RalfJung commented Oct 5, 2023

Would it make sense to keep this open to track the lack of documentation of ltac2val?

@RalfJung RalfJung reopened this Oct 5, 2023
@RalfJung RalfJung changed the title Ability to return values from Ltac2 to Ltac1 Ability to return values from Ltac2 to Ltac1 is not documented Oct 5, 2023
@SkySkimmer
Copy link
Contributor

What lack of documentation? It's in there https://coq.inria.fr/doc/master/refman/proof-engine/ltac2.html#ltac2-from-ltac1

@RalfJung
Copy link
Contributor Author

RalfJung commented Oct 5, 2023

I could have sworn I did Ctrl-f ltac2val and didn't find anything... maybe that was an outdated page? Or I'm unable to type.

Sorry for the noise.

@RalfJung RalfJung closed this as completed Oct 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants