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

Add support for initial context to evaluate commands #213

Open
klinvill opened this issue May 21, 2021 · 3 comments
Open

Add support for initial context to evaluate commands #213

klinvill opened this issue May 21, 2021 · 3 comments

Comments

@klinvill
Copy link
Contributor

Original observation from @lemmy:

I realized that the dialog could be used to support evaluating expressions in a spec that declares variables and/or constants, but lacks a model:

---------------------- MODULE ATD ---------------------
EXTENDS Naturals

CONSTANT N

ASSUME NIsPosNat == N \in Nat \ {0}

Node == 0 .. N-1
=============================================================================

If a user tries to evaluate Node, one gets:

Error evaluating expression:
The constant parameter N is not assigned a value by the configuration file.

It would be nice if one could type WITH N <- 42 in the prompt (suffix of regular TLA+ expression INSTANCE ATD WITH N <- 42).

@klinvill
Copy link
Contributor Author

While using the prompt would be nice for cases where you only have a few constants (like above), it might get unwieldy for specs with many constants. This could be partly improved by persisting previous assignments at a project level. Would it be better to supply initial context by reading in constants from a config file?

@lemmy
Copy link
Member

lemmy commented May 21, 2021

There is already TLC's config file (YourSpec.cfg), and I don't think TLA+ values should be persisted as project-level VSCode settings. Perhaps, it would be useful to generate a more complete YourSpec.cfg? Right now, the VSCode extension just generates CONSTANT, INIT, NEXT. However, we cannot write INSTANCE ATD WITH N <- 42 in YourSpec.cfg, thus we probably want MC.tla/MC.cfg (see #159).

On second thought, my initial observation (this issue) wasn't a good one. Sorry, I should have thought this through.

@klinvill
Copy link
Contributor Author

I agree, I think it makes sense to take advantage of a more complete config like the MC approach you mention. In that case, I'd vote for deferring this until after issue 159 is resolved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants