[swift-evolution] [Pitch] 'Double modulo' operator
brent at architechies.com
Sat May 21 18:40:48 CDT 2016
> You are not taking into account when a function is passed an argument and needs it to be in some range.
If you pass an out-of-range argument, you should reject it using a precondition, thrown error, or nil return value. And if for some reason you really *do* want to force the value into the range, clamping it to the bounds of the range seems like a more sensible solution than modulo. I'm sure there are cases where you *would* want to do this, but they seem like they'd be few and far between.
More information about the swift-evolution