-
Notifications
You must be signed in to change notification settings - Fork 220
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
System::setup() ergonomics #437
Comments
I agree that it could be more ergonomic. There was no intention to make |
Maybe something like this for an alternative setup? Would be a bit boilerplatey and requires constant associated types for less breakage. |
@Aceeri That link seems to be broken for me. |
I think this issue consists of two parts:
Therefore I'd like to document that. Additionally, I'd like to consider deprecating custom |
Moved 2) to #525. |
System::setup()
is currently slightly awkward to use, for a few reasons:It takes a
shred::Resources
instead of aspecs::World
, which has a different and unfamiliar API from everything else in your code (becauseSystem
is just a reexport ofshred::System
). This has consistently tripped me up; it would be nice if it was possible to just useWorld
(orResources
) everywhere.It's operating on an already-initialized version of your data, which means that if you want to load stuff in
setup
you have to putunwrap()
s everywhere inrun()
to get access to fields that you know are present. One way to fix this would be to letrun()
return an error, which would let you useself.prop?
instead ofself.prop.unwrap()
everywhere. Alternatively, it might be possible to make something where you can add struct initialization options to aDispatcher
and trust it to initialize the struct later.These are minor nitpicks, not a big deal, but
setup()
is used a lot so it's good to make it ergonomic :)The text was updated successfully, but these errors were encountered: