amethyst / amethyst/specs

Discourage custom `System::setup`

Offen
#525 25 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
discussion enhancement
Vorherrschende Sprache
Rust
Sterne
2.6k
Forks
215
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.