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

avoid duplication of side effects in upf? #1

Open
gasche opened this issue Aug 6, 2024 · 0 comments
Open

avoid duplication of side effects in upf? #1

gasche opened this issue Aug 6, 2024 · 0 comments

Comments

@gasche
Copy link

gasche commented Aug 6, 2024

The README says:

Note that ppx_update is simple, so if you update with a long expression, that expression will be computed twice.

Maybe you could fix this in the syntax extension so that users don't have to worry about it?

Currently you generate code that looks like if <lexpr>.f == <rexpr> then () else <lexpr>.f <- <rexpr>, but I suppose you could just as easily generate let field = <rexpr> and obj = <lexpr> in if obj.f == field then () else obj.f <- field, which does not suffer from this issue.

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

1 participant