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

Add some warnings for needless context #5604

Open
PgBiel opened this issue Dec 18, 2024 · 0 comments
Open

Add some warnings for needless context #5604

PgBiel opened this issue Dec 18, 2024 · 0 comments
Labels
diagnostics Improvements to compiler errors feature request New feature or request

Comments

@PgBiel
Copy link
Contributor

PgBiel commented Dec 18, 2024

Description

I often see things like context state.update(...) on the support channels. Could be nice to detect some common cases where context isn't necessary, even if it appears to be, initially. (Of course, detecting every case would be very inefficient, maybe even generally impossible. But maybe we can at least tell if we're just constructing a built-in element known to not need context without any particular logic.)

Could be nice to add a hint depending on what one attempted to do.

However, we should make sure to not warn if the user has some logic that would lead to a valid usage of context, e.g. check a variable and return state.update() if true, state.get() if false. So, we should not be too annoying.

Use Case

Help users better understand context's use cases.

@PgBiel PgBiel added feature request New feature or request diagnostics Improvements to compiler errors labels Dec 18, 2024
@PgBiel PgBiel changed the title Add some warnings for useless context Add some warnings for needless context Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
diagnostics Improvements to compiler errors feature request New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant