quint icon indicating copy to clipboard operation
quint copied to clipboard

Require () on actions without parameters?

Open konnov opened this issue 2 years ago • 6 comments

We have the special syntax for the parametereless definitions (val and pure val).

We do not have any special syntax for actions that have zero parameters. I have caught myself writing Init() and Next() in REPL multiple times instead of writing Init and Next. Perhaps, we should require actions to be applied via () only? IMO, this is consistent with the notion of an action.

If we do that, the next question is what to do about temporal formulas.

konnov avatar Sep 26 '22 14:09 konnov

Shouldn't this be consistent across all operators, rather than just across actions?

shonfeder avatar Nov 07 '22 19:11 shonfeder

If we are dropping nullary opeators (as we talked about doing in https://github.com/informalsystems/quint/issues/881), then this doesn't make sense anymore, right?

bugarela avatar Oct 05 '23 19:10 bugarela

If we are dropping nullary opeators (as we talked about doing in #881)

We still need nullary actions, no? (#881 was about nullary defs specifically, afaict)

thpani avatar Oct 09 '23 07:10 thpani

We still need nullary actions, no? (#881 was about nullary defs specifically, afaict)

I think all actions have to be nullary. #881 is about disallowing users to type () in definitions, which might lead them to think they have control over something being nullary or not - which they don't, as all defs and cals are non-nullary and all actions are nullary.

Also, this is all regarding the actual effect of the definition, and not the annotation, as one can write action x = 1 + 1 and that won't be nullary.

bugarela avatar Oct 09 '23 11:10 bugarela

I think all actions have to be nullary

Actions do not have to be nullary. It's quite convenient to have actions like Deposit(fromAddr, toAddr, amount). It's actually up to us what to do about nullary actions. For instance, action step() = ... could indicate that it's not like a standard definition but a definition of an action, which is different from a value. Of course, in presence of the keyword action it seems to be redundant.

konnov avatar Oct 09 '23 15:10 konnov

I think all actions have to be nullary

I meant all actions without parameters have to be nullary. In the sense that is no difference between action foo = ... and action foo() = .... In practice, they will both be re-evaluated every time they are called.

bugarela avatar Oct 10 '23 11:10 bugarela