17 ms·
"It's annoying" is a pretty good reason. If you don't mind function names like that, go become a Java Enterprise programmer, see how you like it after a few yea
by OskarS 5y ago
"It's annoying" is a pretty good reason. If you don't mind function names like that, go become a Java Enterprise programmer, see how you like it after a few years.
In addition: it's the wrong solution to the problem. The units shouldn't be baked in to the function definition, just the type of quantity. You should be able to do both:
setSpeed(10 m/s)
and
setSpeed(45 km/h)
Which you can do in many languages. In fact, time functions in C++ work exactly like this. If you want to suspend a thread for 10 seconds you do
std::this_thread::sleep_for(10s);
but if you want to suspend it for 5 milliseconds, you do
std::this_thread::sleep_for(5ms);
And if you just supply a unitless number, it's a compiler error.