Skip to content

Extensible builder syntax for system insertion #1978

Closed
@alice-i-cecile

Description

@alice-i-cecile

What problem does this solve or what need does it fill?

As we create more and more interesting ways to initialize systems, the number of AppBuilder methods we require explodes in an exponential fashion.

add_system becomes add_startup_system becomes add_startup_system_to_stage become add_startup_system_set_to_stage becomes...

What solution would you like?

Use two base methods add_system and add_system_set. Then, use the builder pattern (see EntityCommands for an example) to replicate the existing API using method chaining.

For example, add_startup_system_set_to_stage(my_stage, my_system_set) would become add_system_set(my_system_set).startup().to_stage(my_stage).

What alternative(s) have you considered?

Continue expanding our API and method names. That's what IDEs are for right? ;)

Additional context

This would help enable the subworlds RFC and similar extensions.

This is a very nice building block for "labels of mass description", hinted at in #1375. It also opens the door to principled modification of systems added by plugins (e.g. to move them into the required States).

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-ECSEntities, components, systems, and eventsC-Code-QualityA section of code that is hard to understand or changeC-FeatureA new feature, making something new possibleC-UsabilityA targeted quality-of-life change that makes Bevy easier to useD-ComplexQuite challenging from either a design or technical perspective. Ask for help!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions