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

disable export_theory in interactive mode #1395

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

digama0
Copy link
Contributor

@digama0 digama0 commented Feb 11, 2025

Also a possibility: using Globals.interactive as the default value of the flag. I decided not to because I am not sure if users like to run export_theory manually in REPL sessions (they shouldn't). Edit: implemented

This flag is needed to prevent hol4-vscode from generating actual theory outputs when the server reads and runs the file in fast-cheat mode. (Yes, I tried rebinding export_theory. It's not reliable because the massive block of opens at the top of most script files has a tendency to re-rebind it.)

@mn200
Copy link
Member

mn200 commented Feb 11, 2025

If we have to have a guard on this at all, then I'd prefer to let it just be Globals.interactive (and then Theory.sig can stay as it is).

While working in the "before-times" (before we have a nice syntax #1364), I'd still prefer to have you rebind the SML value, along with enforcing the requirement that all open declarations occur at the head of the file. (Meaning the rebind can reliably be applied after doing all those opens.)

@digama0
Copy link
Contributor Author

digama0 commented Feb 11, 2025

Currently the HOL parser doesn't even parse open declarations, which makes this annoying to do correctly. Plus mid-file opens are a thing. The syntax of #1364 is precisely what we need in order to do this properly, until then I'm still having to deal with a significant fraction of breakages when using hol4-vscode normally.

@mn200
Copy link
Member

mn200 commented Feb 11, 2025

Mid-file opens should not be a thing. I'd happily grasp that (and other) nettle first just so that eventually layering over a nicer syntax can be done as a separate concern.

For the purposes of keeping this particular commit small, please just guard exporting with Globals.interactive.

@digama0
Copy link
Contributor Author

digama0 commented Feb 11, 2025

I think mid-file open should be a thing, where I mean specifically open and not the load side effect. open is a normal operation in SML and it is weird to restrict its use to the top of the file; it is used in let blocks too. It is the open effect and not the load effect that is problematic in this particular case, while #1364 is aimed at restricting the load effect to the top of the file.

@digama0 digama0 force-pushed the disable_export_theory branch from 4890b3d to d58053b Compare February 11, 2025 14:49
@digama0 digama0 changed the title add flag to disable export_theory disable export_theory in interactive mode Feb 11, 2025
@mn200
Copy link
Member

mn200 commented Feb 11, 2025

Of course, open should be freely usable in non-Script files. In script files, it is equally reasonable to restrict top-level occurrences to the top of the files. (People shouldn't be writing much code with nested open in script-files, but it's reasonable to keep it legal.)

open's shotgun destruction of the namespace is a very bad thing to have happen in the middle of a script.

@mn200
Copy link
Member

mn200 commented Feb 11, 2025

It looks like some test-cases will need to be adjusted.

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

Successfully merging this pull request may close these issues.

2 participants