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

Redesign Goptions API #20051

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

SkySkimmer
Copy link
Contributor

- use GADT to control the type of the value

- remove "Set ... Append" command, instead appending is a behaviour of
  the given option (currently Warnings and Debug)

- expose API for unsynchronized options (would allow to fix the code
  in MetaCoq/metacoq#1123 instead of removing it)
@SkySkimmer SkySkimmer added kind: redesign The same functionality is being re-implemented in a different way. request: full CI Use this label when you want your next push to trigger a full CI. labels Jan 14, 2025
@SkySkimmer SkySkimmer added this to the 9.1+rc1 milestone Jan 14, 2025
@SkySkimmer SkySkimmer requested review from a team as code owners January 14, 2025 15:07
@coqbot-app coqbot-app bot removed the request: full CI Use this label when you want your next push to trigger a full CI. label Jan 14, 2025

(** Helper to build synchronized options on top of [declare_unsynchronized_option]. *)
val option_object : string -> Summary.Stage.t -> ('a -> unit) ->
(option_locality * 'b, option_locality * 'a, option_locality * 'b) Libobject.object_declaration
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SkySkimmer , can we find a different solution for this problem?

This will break in coq-lsp / Flèche for example, and it makes impossible to properly cache command execution. Moreover, I think this is generally a footgun.

Note that we used to have this kind of "unsynchronized" options but there were removed long time ago, happy to dig the relevant issues PRs if you are curious. IIRC, all uses of them were incorrect.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think for the problem in MetaCoq/metacoq#1123 an unsynchronized option (but backed by the synchronized state of the other option) really is the correct solution.

I don't know what you mean by "this will break"

Copy link
Member

@ejgallego ejgallego Jan 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean:

  • assume an unsynchronized option "Foo." that affects for example de-elaboration.
  • imagine that I have a file:
Theorem foo : ...

Set Foo.

Theorem bar : ...
  • now the user clicks on bar, so I print the goals there
  • now the user clicks on foo, so I restore the state to print the goals there
  • however the option is still set as lives outside the summary.

I do think we have a need for this kind of use cases, for example, I don't like that backtracking setting lives in the summary, however IMHO we should not expose via GOptions, see the long discussion when we removed the unsync parameter. (Basically GOptions are controlled via sentences in the document, IMO everything in the document should be synced)

What do you think? We can maybe split that change to a different PR while we discuss if you wanna get the rest merged.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The way I think of it, declare_unsynch_option is mostly not for declaring actually unsynchronized options, rather it's for declaring options with different synchronization from what the standard declare_option does.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is "different synchronization option from what the standard declare_option does" mean? Isn't that "unsynchronized"?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm talking about declare_unsynchronized_option indeed, sorry I placed my comment on the wrong place.

Let me re-state my worry: I'm against declare_unsynchronized_option for the reasons stated above.

Would it be too much of a trouble to split that change to a different PR and continue the discussion there?

I see declare_unsynchronized_option is not used here, and the rest of the PR seems fine.

Copy link
Member

@jfehrle jfehrle Jan 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does seem like quite a bad idea to break the well-established existing behavior when rolling back options. I would ask a) is this only possible way to fix this bug? and b) what are other examples of when this feature would be useful? Is it really a design flaw in metacoq? Unsynchronized options seems like something that's ripe for abuse/problems and perhaps hard to find when there is a problem.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be too much of a trouble to split that change to a different PR and continue the discussion there?

unsynchronized_option and being able to fix the metacoq bug instead of having to delete the feature is the main motivation for the PR, the other changes are mainly to make it nicer (eg not having to deal with append)

I don't know what is not clear about the need for unsynchronized_option in the comment above it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not clear why we need to introduce stuff that does break live the summary and as Jim points out will break expected document behavior.

Also it is not clear why we cannot use a different solution, like adding grouping or ordering instead of this in my opinion very problematic solution with large potential for misuse.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't break the summary, declare_option isn't even where the state is declared (unlike declare_option_and_ref)

Copy link
Contributor

coqbot-app bot commented Jan 14, 2025

🔴 CI failures at commit a5148e7 without any failure in the test-suite

✔️ Corresponding jobs for the base commit 818d1e0 succeeded

❔ Ask me to try to extract minimal test cases that can be added to the test-suite

🏃 @coqbot ci minimize will minimize the following targets: ci-fiat_crypto_legacy, ci-hott, ci-rewriter
  • You can also pass me a specific list of targets to minimize as arguments.

Copy link
Member

@ejgallego ejgallego left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having Set Foo. live outside the summary breaks the expected semantics for documents and makes the lives of document managers hard, in particular I'd break coq-lsp.

A different solution to the problem can be implemented.

@SkySkimmer
Copy link
Contributor Author

Having Set Foo. live outside the summary breaks the expected semantics for documents and makes the lives of document managers hard, in particular I'd break coq-lsp.

Set isn't special, any command with state needs to synchronize it. This PR only allows hooking into Set instead of having to write some custom command.

@ejgallego
Copy link
Member

ejgallego commented Jan 15, 2025

Set isn't special, any command with state needs to synchronize it. This PR only allows hooking into Set instead of having to write some custom command.

Let me see again, I guess I'm misunderstanding.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: redesign The same functionality is being re-implemented in a different way.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy