Skip to content

Make logical AND explicit in filters with an And<(..)> combinator #9347

Closed
@iiYese

Description

@iiYese

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

The usage of (..) in query filters is inconsistent with the usage of (..) everywhere else in bevy. In other APIs like Bundle, WorldQuery, IntoSystemConfigs, IntoSystemSetConfigs etc. tuples are just a means to express variadics which rust lacks at the moment. They do not have special meaning on their own.

What solution would you like?

Add an explicit And<(..)> combinator and make the meaning of tuples in filters be consistent with the meaning of tuples elsewhere in bevy.

Additional context

Any time any changes need to be made to filters there seems to be inevitable boolean algebra bike shedding because of this inconsistency like in #9255. This is always because people come in with different mixed notions of what (..) means which is either:

  • Var args. Using tuples to work around rust lacking variadic generics. Informed by the encounters of (..) outside query filters in the mentioned APIs.
  • Logical AND. Using tuples to implicitly mean logical AND. Informed by what is currently uniquely the status quo for query filters.

Decoupling these and making distinct mechanisms for each stops this pattern from occurring.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-ECSEntities, components, systems, and eventsC-UsabilityA targeted quality-of-life change that makes Bevy easier to useX-ControversialThere is active debate or serious implications around merging this PR

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions