Skip to content
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

Deduplicate App <-> World APIs #17026

Open
BenjaminBrienen opened this issue Dec 29, 2024 · 2 comments
Open

Deduplicate App <-> World APIs #17026

BenjaminBrienen opened this issue Dec 29, 2024 · 2 comments
Assignees
Labels
A-App Bevy apps and plugins C-Usability A targeted quality-of-life change that makes Bevy easier to use D-Modest A "normal" level of difficulty; suitable for simple features or challenging fixes S-Needs-Design This issue requires design work to think about how it would best be accomplished

Comments

@BenjaminBrienen
Copy link
Contributor

It feels like that method would make sense as modify_world? Overall I think that the App <-> World duplication / API mess around multiple worlds needs a real design to solve, and we should be nervous about just adding a dozen little fixes.

Originally posted by @alice-i-cecile in #16977 (comment)

@BenjaminBrienen BenjaminBrienen added A-App Bevy apps and plugins C-Usability A targeted quality-of-life change that makes Bevy easier to use D-Modest A "normal" level of difficulty; suitable for simple features or challenging fixes S-Needs-Design This issue requires design work to think about how it would best be accomplished labels Dec 29, 2024
@BenjaminBrienen BenjaminBrienen self-assigned this Dec 29, 2024
@BenjaminBrienen
Copy link
Contributor Author

I intend to create a "spike" PR to see if my idea for a single helper method to make the entire world API available while building an App is a good design. Feel free to discuss ideas!

@alice-i-cecile
Copy link
Member

The big challenge here is that half of Bevy's API / design is built around a one World <-> one App design, and the other half is kind of trying to support multiple worlds (currently via SubApps). Sticking with SubApps might be the right move, but I'd like a real design for them.

Some ideas:

  1. If we're planning on always having a strict one-to-one correspondence, I would be tempted to use a Deref / DerefMut pattern to get delegation from App -> World. Unfortunately, that doesn't work: the chained builder pattern will break since you'll have a &mut World when you want a &mut App.
  2. We could push users away from the builder pattern, by using a structured approach to plugins, where you have a dozen different methods, one for each kind of API. See Order independence of App construction #1255 for more background on this.
  3. We could move all of the common methods onto a trait. Much less discoverable, but tidier.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-App Bevy apps and plugins C-Usability A targeted quality-of-life change that makes Bevy easier to use D-Modest A "normal" level of difficulty; suitable for simple features or challenging fixes S-Needs-Design This issue requires design work to think about how it would best be accomplished
Projects
None yet
Development

No branches or pull requests

2 participants