-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Component: Sync (might be) too strict. #2487
Copy link
Copy link
Closed as not planned
Labels
A-ECSEntities, components, systems, and eventsEntities, components, systems, and eventsC-Code-QualityA section of code that is hard to understand or changeA section of code that is hard to understand or changeC-FeatureA new feature, making something new possibleA new feature, making something new possibleC-PerformanceA change motivated by improving speed, memory usage or compile timesA change motivated by improving speed, memory usage or compile timesS-Ready-For-ImplementationThis issue is ready for an implementation PR. Go for it!This issue is ready for an implementation PR. Go for it!
Description
What problem does this solve or what need does it fill?
Our requirements are too strict. This stops us from using types which are Send but not Sync in components, such as Cell<T>.
What solution would you like?
Remove the bound of Sync on component, and audit all the methods of World to ensure that any which go from &World->&T require T: Sync (primarily the SystemParam impl for &'_ T).
Note that the impl for &'_ mut T would not require Sync, since we guarantee that this reference is only on one thread (since the resultant Mut<T> can be used to get an &mut T directly).
What alternative(s) have you considered?
Keep things as they are - we haven't had a need for this yet, and it seems unlikely that we ever will.
However, philosophically there's no reason to have these bounds, and it strictly increases our usefulness.
Additional context
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-ECSEntities, components, systems, and eventsEntities, components, systems, and eventsC-Code-QualityA section of code that is hard to understand or changeA section of code that is hard to understand or changeC-FeatureA new feature, making something new possibleA new feature, making something new possibleC-PerformanceA change motivated by improving speed, memory usage or compile timesA change motivated by improving speed, memory usage or compile timesS-Ready-For-ImplementationThis issue is ready for an implementation PR. Go for it!This issue is ready for an implementation PR. Go for it!