More flexible SystemInput#21917
Conversation
chescock
left a comment
There was a problem hiding this comment.
Note that #21916 and cBournhonesque#4 are alternative approaches to the same goal. I'm approving because this is a solid implementation of this approach, but I personally prefer #21916 because the change is smaller, and because associated types are less likely to cause type inference failures.
For example, world.run_system_cached_with(|_: StaticSystemInput<In<usize>>| {}, 0) would fail with "type annotations needed" under this PR, since I can be either In<usize> or StaticSystemInput<In<usize>>, while under #21916 it would unambiguously be In<usize>.
I don't know of any realistic use cases that would run into that problem, though. The only reason to use StaticSystemInput is if you're generic in the input type, like pipe, and in that case the types will all be written out anyway.
Valid! I still think I like this approach since it's a bit more symmetrical and doesn't add a new associated type, but I agree there could be problems with inference. I don't think there will be much more than present though, since IntoResult already leads to some ambiguities (like with |
284e441 to
826d1c0
Compare
ItsDoot
left a comment
There was a problem hiding this comment.
As long as we can't prove further type inference issues in general usecases, I'd be fine with this actually. Looks good besides the one thing.
|
Note for final review: This PR is an alternative to #21916, so if you feel that one's better please merge that one instead! 🙂 |
2cb66e7 to
8a6708a
Compare
8a6708a to
8981fcb
Compare
Objective
Allow functions accepting
StaticSystemInputas input to be used as systems accepting the inner type.Solution
Testing
input.rsShowcase
Click to view showcase