-
Notifications
You must be signed in to change notification settings - Fork 10
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
[RFC] System name constants #20
Comments
Currently I'm not sure this is something worth changing. For example, this https://github.com/amethyst/amethyst/blob/b24355d36fc728b19eb4f1ccebfe805acc6ffd21/amethyst_core/src/transform/bundle.rs#L12 |
The part about "except with bundles" doesn't uphold the "all systems are declared at the same place" bit. Consider the scenario:
Re:updating docs, I know docs should be updated, but it's also easy to miss / forget, whereas when code is updated, the compiler catches it, and I often lean towards that automated catch. Re:effort, I've recently implemented the system naming using
|
You actually have to implement this in the shred crate. If it works there, then on the amethyst side we can add it too. |
I thought about it, and it may make sense to change the 'static str to a T: Eq in some cases. I'm not sure how you could make this work with the engine's bundles though. |
@azriel91 @Jojolepro is this still relevant? |
@torkleyy do you want to take note of this somewhere? Should it be reopened as an issue on the shred or specs repo? |
For now I'm happy to close until we decide to engineer either or both of these:
|
Moving this to the RFC repo |
Hey, I had to write this out so that I don't forget it.
When a bundle adds a system to a dispatcher, it provides a name which is used in system dependency ordering. The system name is effectively API, as external systems that depend on that system specify it as a dependency.
While the number of systems is small, it isn't hard to maintain a few
&'static str
s. However when there are many systems, if I make a typo, or the name has changed, using&str
s defers failure to application startup (runtime) instead of compile time. If we can use constants or a function that returns a derivable system name, it would decrease the maintenance cost for larger applications.Things to consider:
System
s are generally not public outside of a crate, so we'd have to expose the name some other way.AnimationControlSystem<I, T>
, where the type parameters are defined by the consumer / application codePossible useful crates:
named_type
, but would depend on Include generic type parameter names cjhowedev/named_type#5typename
Alternatives:
The text was updated successfully, but these errors were encountered: