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

Diverging functions do not need to modify state #317

Open
shym opened this issue Aug 25, 2023 · 1 comment
Open

Diverging functions do not need to modify state #317

shym opened this issue Aug 25, 2023 · 1 comment

Comments

@shym
Copy link
Contributor

shym commented Aug 25, 2023

Currently gospel check rejects:

val run : unit -> unit
(*@ run ()
    diverges *)

with:

Error: The function `run' returns `unit'
       but its specifications does not contain any `modifies' clause.

We could consider that:

  • the function that only diverges should be ruled out,
  • or modifies (), or something similar, is the canonical annotation for such cases,
  • or that diverges or modifies would be required for unit-returning functions.
@n-osborne
Copy link
Contributor

gospel check should indeed at least accept this specification for the run function.
An other example is the sleep function, that does not diverge but returns unit without modifying anything (that we can express in the specification).

I'm thinking that having the absence of modifies clause for unit-returning function as an error may be a bit too strong. A warning may be more appropriate.

shym added a commit to shym/gospel that referenced this issue Oct 4, 2023
Since ocaml-gospel#317 was not yet addressed, add an explicit `(* ... *)` to hint
that the proposed specification cannot be used all by itself (yet)
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

No branches or pull requests

2 participants