amethyst / amethyst/specs

Discourage custom `System::setup`

Ouverte
#525 25 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
discussion enhancement
Langage dominant
Rust
Étoiles
2.6k
Forks
215
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

This issue is split out of #437.

Using `System::setup` for initialization, while often being convenient, brings three major drawbacks with it:

* implicit resource creation -> might be using the wrong resource, especially when generics are involved (one system uses `Foo`, the other one `Foo` and both will fail to see the changes of the other one)
* initializing system fields with it means:
* fields need to be `Option`s
* resource initialization is decentralized (whether one considers that as a drawback or not)
* resources / system fields can hardly depend on each other when initialized using `setup`, possibly leading to (undocumented) ordering requirements of the setup calls

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.