-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Documentation mentionting chained .run_if(a).run_if(b) does not short-circuit, in contrast to run_if(a.and(b)) #21710
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
base: main
Are you sure you want to change the base?
Conversation
|
Welcome, new contributor! Please make sure you've read our contributing guide and we look forward to reviewing your pull request shortly ✨ |
alice-i-cecile
left a comment
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.
I think mdlint is going to have words with you for your formatting, but I like the content for the most part.
The system_registry.rs changes look like they shouldn't be included in this PR.
| /// - Have independent change detection | ||
| /// - Update ticks even when skipped by conditions | ||
| /// | ||
| /// Later systems in the chain will see changes made by earlier systems while maintaining |
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.
Somewhere in here, I think it would be helpful to explicitly call out that this is equivalent to adding before / after system orderings.
| /// - Chained calls like `.run_if(a).run_if(b)` evaluate all conditions independently | ||
| /// - Single call like `run_if(a.and(b))` short-circuits (`b` won't run if `a` is false) | ||
| /// | ||
| /// For per-system condition evaluation, use [`distributive_run_if`]. |
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.
The "Note" section below already mentions distributive_run_if with a bit more context, so I'd be inclined to leave this line out (or else move the whole "Note" up here).
| /// Each individual condition will be evaluated at most once (per schedule run), | ||
| /// right before the corresponding system prepares to run. | ||
| /// | ||
| /// # Tick and Change Detection Behavior |
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.
If we're mentioning that each copy of the system keeps its own ticks, then it might also be worth mentioning that each one also keeps its own parameter state. Notably, MessageReader will have a separate cursor for each one, so copies of on_message may return different values.
And similarly for the mentions of tick state and change detection in fn chain().
| /// - Execute in sequential order | ||
| /// - Each maintain their own tick state | ||
| /// - Have independent change detection | ||
| /// - Update ticks even when skipped by conditions |
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.
Is this right? I thought systems only set their last_run tick when they actually ran, and not when skipped by conditions. Chaining them shouldn't affect that, should it?
|
@ZackaryRippee once CI is passing I'm content to merge this, but you may want to consider Checock's feedback too :) |
Objective
solving issue #21244
Solution
Testing