-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Open
Labels
A-ECSEntities, components, systems, and eventsEntities, components, systems, and eventsC-UsabilityA targeted quality-of-life change that makes Bevy easier to useA targeted quality-of-life change that makes Bevy easier to useX-ControversialThere is active debate or serious implications around merging this PRThere is active debate or serious implications around merging this PR
Description
A potentially more controversial option is just to have `&T` return `Ref<T>` instead. Though that might require some benchmarking to ensure there's no perf regression in doing so.
Originally posted by @james7132 in #7306 (comment)
A nice thing about making &T return Ref is that it would make the ReadOnly assoc type on &mut T have an "obvious answer", with this PR it could realistically be &T or Ref. I think the only downside that Mut has that Ref would also have is the fact that you cant pattern match on it, the other issues (shoving mut everywhere and borrowck annoyances from disjoint borrows) dont apply to Ref which is cool.
Boxy's followup.
This would align us further with the behavior of &mut, and ensure that change detection behavior is always available to users.
Metadata
Metadata
Assignees
Labels
A-ECSEntities, components, systems, and eventsEntities, components, systems, and eventsC-UsabilityA targeted quality-of-life change that makes Bevy easier to useA targeted quality-of-life change that makes Bevy easier to useX-ControversialThere is active debate or serious implications around merging this PRThere is active debate or serious implications around merging this PR