amethyst / amethyst/rfcs

[RFC] System name constants

Đang mở
#20 8 bình luận 1 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Không có dữ liệu ngôn ngữ
Star
32
Fork
10
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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.
* What about Systems with generic parameters, such as `AnimationControlSystem`, where the type parameters are defined by the consumer / application code

Possible useful crates:

* [`named_type`](https://github.com/cjhowe7/named_type/), but would depend on https://github.com/cjhowe7/named_type/issues/5
* [`typename`](https://crates.io/crates/typename)

Alternatives:

* Do nothing — perhaps the maintenance cost isn't big enough for this effort to be undertaken.

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.