Replies: 2 comments 7 replies
-
I think I have continued the discussion on this in the wrong thread: #207 (comment) |
Beta Was this translation helpful? Give feedback.
7 replies
-
I don't think we are going to change this in the near future. But we can always reopen this discussion! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Closely related to the discussion about actions in #207
Problematic
In TLA, (state) variables are state functions:
Understood from the perspective of the programs specified by a TLA formula, state variables correspond to globally visible mutable regions of state. However, a programmer familiar with sateful programming (which includes Haskeller's: they just have the discipline to quarantine their stateful sub-programs) will be led astray if they try to think of the state variables as mutable values within the context of a TLA spec (see #372 (comment)).
I don't know of a good, precise analog to the semantics of state variables within a TLA formula in any widely used programmings language I'm familiar with. A trick with Prolog DCGs for "Implicitly passing states around" is the closest thing I can think of.
Given the central importance, relative strangeness, and many gotchas of TLA state variables, they may be a good candidate for use of syntactic salt.
Motivation
<-
can only be used directly on state-variables (and not, on references to them, e.g., passed in through operator parameters).Concrete syntax proposal
An option we've discussed is to add a distinctive lexical marker to all state variables. The concrete syntax suggested by @bugarela is prefixing variables with a
@
. iirc, this is inspired by Ruby's use of@
for class instance variables.Translating an example from one of our example specs, this proposal would look like the following:
Beta Was this translation helpful? Give feedback.
All reactions