allwpilib
allwpilib copied to clipboard
[command based] add Measure<Time> overload of WaitCommand
Resolves #6382
Hi really cool that you took my issue, do you think there could be an overload added to the Commands.java class so that the static factory methods can be used with this?
If already, I think having the factory is more important than the constructor overload.
/format
/format
Command::withTimeout
should also receive an overload.
/format
Is a static wait(Measure) overload going to be potentially confusing, as Java Object.wait(long) exists? That's the major reason why it's waitSeconds() instead of wait().
Dammit Java.
It'll be less confusing than the possible wait(double)
. Object.wait
being non-static where the other functions are static should also help here, as it won't be in the same scope (though with static import that could change).
I'm not sure. Dammit Java.
Idk if I should rename this but right now there is no wait(double) it's waitSeconds(double) purely because my lsp only renamed the overload...
What me and Peter are saying is that waitSeconds
was not named wait
to avoid confusion with Object.wait(long)
(which is very much not what our users are looking for), and we're apprehensive about the naming of wait(Time)
for the same reason.
The parameter type here makes me a bit less worried (double
vs long
can also confuse compiler method resolution, whereas Time
vs long
won't) -- though users looking for the non-unit overload of wait(Time)
might look for a wait
and not waitSeconds
, so idk.
There's also the distinction that the void-returning Object.wait(long)
won't fit in the relevant call sites needing a Command
to be returned.
waitTime(t)
seems like a good replacement name.