What problem does this solve or what need does it fill?
The hard line between exclusive and non-exclusive systems results in very frustrating UX: users must learn a whole new API with complex borrow-checking rules in order to access the world.
Many convenient, ergonomic APIs (like EventReader) must be manually reimplemented or worked around, encouraging code duplication both within the engine and in user code.
What solution would you like?
- Other system parameters can coexist with
&mut World.
- Conflicts are checked on the basis of these other system parameters.
- The
World returned by &mut World is incomplete: any data required by other system parameters is removed from it for the duration of the system.
- Under the hood, this uses
resource_scope and other parallel APIs.
Status
This is a large task, and should be done in a piecemeal fashion.
As a result, it seems like there's a split between "scopable" and "non-scopable" system parameters, that we should probably try to reflect in the type system somehow.
What alternative(s) have you considered?
WorldCell is an API that exists largely to get around this pain. #3939 proposes removing it completely, due to its limitations and runtime-panicking nature.
#4090 also attempts to relieve this pain, but there are some things that genuinely require &mut World access.
Additional context
Dissolving the boundaries between exclusive and regular (FunctionSystem) systems is one of the incidental goals behind the Stageless RFC. This design would help further that process.
#4157 is a necessary step to allow us to extend this work to queries (and hence entity-component data).
This is likely to be useful when working with e.g. saving the game, working with scenes or networking, as we commonly want to operate on a massive scale across the whole world, except for some data that is used for coordinating the task.
What problem does this solve or what need does it fill?
The hard line between exclusive and non-exclusive systems results in very frustrating UX: users must learn a whole new API with complex borrow-checking rules in order to access the world.
Many convenient, ergonomic APIs (like
EventReader) must be manually reimplemented or worked around, encouraging code duplication both within the engine and in user code.What solution would you like?
&mut World.Worldreturned by&mut Worldis incomplete: any data required by other system parameters is removed from it for the duration of the system.resource_scopeand other parallel APIs.Status
This is a large task, and should be done in a piecemeal fashion.
World::resource_scope#4159.EventReader.World::query_scopeAPI #4157.Commandsfrom&mut World#3096, but not completely solve it.Entities,Archetypesand&World: these are fundamentally impossible (or useless), as they are part of the metadata of the world.As a result, it seems like there's a split between "scopable" and "non-scopable" system parameters, that we should probably try to reflect in the type system somehow.
What alternative(s) have you considered?
WorldCellis an API that exists largely to get around this pain. #3939 proposes removing it completely, due to its limitations and runtime-panicking nature.#4090 also attempts to relieve this pain, but there are some things that genuinely require
&mut Worldaccess.Additional context
Dissolving the boundaries between exclusive and regular (
FunctionSystem) systems is one of the incidental goals behind the Stageless RFC. This design would help further that process.#4157 is a necessary step to allow us to extend this work to queries (and hence entity-component data).
This is likely to be useful when working with e.g. saving the game, working with scenes or networking, as we commonly want to operate on a massive scale across the whole world, except for some data that is used for coordinating the task.