Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Objective
The objective of this RFC is the same as in #10618: how to declare one system depends on the other while keeping such configuration robust to the changes.
Solution
Previous RFC suggested making it native to Bevy: each system param could declare before/after system sets.
Some considered that RFC too controversial and not fitting well into Bevy ESC model.
API: user metadata
This RFC proposes alternative solution to the problem. Each
SystemParam
can supply arbitrary metadata. Metadata is a Rust value of arbitrary type.API is similar to Error::provide API from rust stdlib.
How it can be used
A user outside of Bevy can declare two special parameter types:
Before<T: SystemSet>
andAfter<T: SystemSet>
. These parameter types would emit metadata likeBeforeItem(InternedSystemSet)
andAfterItem(InternedSystemSet)
.Bevy would not automatically do anything with this knowledge (it is just opaque metadata for the scheduler).
But a user can implement utilities over
App
to account for this metadata to adjust the scheduler.In pseudocode:
Meta vs builtin
Frankly I don't see any applications of param meta outside of these scheduling labels, and this meta will not be very ergonomic (although it would solve the problems I described in the previous RFC). So I would prefer scheduling instructions to be built in Bevy.
But I'd be fine with any solution which would solve the problem, even if user code would be verbose.
And, last words, I'm not going to die on this hill. If this idea is not good enough either, I think I can live with existing API which requires looking very hard to verify schedule correctness.