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

Compiler: warn when bare state chains are used #630

Open
josephjclark opened this issue Mar 18, 2024 · 0 comments
Open

Compiler: warn when bare state chains are used #630

josephjclark opened this issue Mar 18, 2024 · 0 comments

Comments

@josephjclark
Copy link
Collaborator

We teach users to pass state values into operations.

But state references can go stale (an issue made worse by global state, which I think should be removed, see #17) or not be assigned yet because they are read synchronously.

For example:

get('/some-data')
post('some-data', state.data)

This code will fail because the value of state.data is read synchronously, because the get was completed.

It should be written with some kind of lazy state evaluation, like this:

get('/some-data')
post('some-data, (state) => state.data)

The compiler should be able to detect references to state (literally that global variable reference) and raise a warning when it is used in a naive chain like this.

@josephjclark josephjclark changed the title Compiler: warn when bare state chain are used Compiler: warn when bare state chains are used Apr 2, 2024
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