| ▲ | kennywinker 5 hours ago | ||||||||||||||||||||||||||||||||||
For a function setVelocity() that can accept 1..<200. You call it with numbers that you enter directly and types tell you something that would otherwise be a comment on the function, or you do runtime checks elsewhere, and the type becomes proof that you checked them before handing it into the function. Btw, using “autism” to mean “pedantry” leaves a bit of a bad taste in my mouth. Maybe you could reconsider using it that way in the future. | |||||||||||||||||||||||||||||||||||
| ▲ | samdoesnothing 5 hours ago | parent [-] | ||||||||||||||||||||||||||||||||||
Pushing everything to types like this creates a different burden where you're casting between types all over the place just to use the same underlying data. You could just clamp velocity to 200 in the callee and save all that hassle. | |||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||