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

Pointwise state modifications #416

Open
radrow opened this issue Sep 16, 2022 · 3 comments
Open

Pointwise state modifications #416

radrow opened this issue Sep 16, 2022 · 3 comments
Labels
effort: medium enhancement New feature or request

Comments

@radrow
Copy link
Member

radrow commented Sep 16, 2022

This would be a syntactic sugar that would possibly make it nicer to modify state fields (if it is a record, which is mostly the case).

record r = {val : int}
record state = {x : int, y : r}
stateful function f() =
  state.x = 21
  state.y.val = 37

which would desugar to

put(state{x = 21})
put(state{y = state.y{val = 37}})

and ideally to

put(state{x = 21, y = state.y{val = 37}})
@radrow
Copy link
Member Author

radrow commented Sep 16, 2022

Note that state modifications are still explicit, as one needs to refer to the state as lvalue.

@radrow radrow added enhancement New feature or request effort: medium labels Sep 16, 2022
@brainiacfive
Copy link

+1

I thought the compiler optimizes multiple puts into one at any rate.

@marc0olo
Copy link
Contributor

oh yeah, I like this one! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
effort: medium enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants