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

Remove the ability to directly use strings as labels #4341

Closed
alice-i-cecile opened this issue Mar 26, 2022 · 2 comments
Closed

Remove the ability to directly use strings as labels #4341

alice-i-cecile opened this issue Mar 26, 2022 · 2 comments
Labels
A-ECS Entities, components, systems, and events C-Code-Quality A section of code that is hard to understand or change

Comments

@alice-i-cecile
Copy link
Member

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

Following #4219, system function types can be used directly as labels.

This removes the last serious use of strings as labels: for "quick and dirty" implementations.

"Stringly typed" labels are inferior because:

  1. They are not IDE or compiler aware, and so typos are very challenging to detect.
  2. They can clash in very surprising ways between crates.
  3. They cannot be kept private.

What solution would you like?

  1. Remove the ability to use string types as labels.
  2. Update codebase, including examples and tests, to reflect this change.

Additional context

Raised in #4340 by @DJMcNab.

Note that labels that store a string may be useful in some applications for e.g. scripting integration. This is still supported: you just have to newtype your string.

@alice-i-cecile alice-i-cecile added A-ECS Entities, components, systems, and events C-Code-Quality A section of code that is hard to understand or change labels Mar 26, 2022
@DJMcNab
Copy link
Member

DJMcNab commented Apr 26, 2022

We've had a discussion in discord, and my understanding of the consensus is that we should wait for stageless to implement this

We can fix the tests which rely on this beforehand - a lot of them can probably use const generics.

bors bot pushed a commit that referenced this issue Sep 3, 2022
# Objective

* Related: #4341
* Remove all remaining uses of stringly-typed labels in the repo. Right now, it's just a bunch of tests and examples.
james7132 pushed a commit to james7132/bevy that referenced this issue Oct 28, 2022
# Objective

* Related: bevyengine#4341
* Remove all remaining uses of stringly-typed labels in the repo. Right now, it's just a bunch of tests and examples.
ItsDoot pushed a commit to ItsDoot/bevy that referenced this issue Feb 1, 2023
# Objective

* Related: bevyengine#4341
* Remove all remaining uses of stringly-typed labels in the repo. Right now, it's just a bunch of tests and examples.
@hymm
Copy link
Contributor

hymm commented Feb 6, 2023

&str no longer implements label (SystemSet) after #6587

@hymm hymm closed this as completed Feb 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ECS Entities, components, systems, and events C-Code-Quality A section of code that is hard to understand or change
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants