-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Simplify conditions #11316
Simplify conditions #11316
Conversation
Alright fixed all the docs tests. Messed up the pr commits though -_- Edit: Fixed hopefully |
b89ff86
to
2dd6a35
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice simplification!
They were originally made closures to keep the API consistent. i.e. you always call the built-in run conditions as functions when adding them in run_if. |
I think this is a mistake overall: we should model the correct, simple behavior for users. See the previous PR by this author, who thought that it was required to use closures. It's not the first time I've seen that, and I was confused about where the misconception was coming from. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Docs should be updated on changed conditions (eg. here) to reflect new behavior. It could be something like
/// A [`Condition`](super::Condition)-satisfying system that returns `true`
...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything here is pretty clear, looks correct and improves readability and flexibility.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, a clear ergonomic improvement. i think this also reduces confusion, since what is passed to run_if
is more obviously a function, it's slightly easier for beginners to recognise that conditions aren't called once and then are called based on that stored flag.
btw @alice-i-cecile, i'd be happy to become an org member!
Done |
Objective
Solution
Changelog
The following run conditions are now regular systems:
Migration Guide