If I came across a method on an integer that was isDivisible(by:)
, I would assume it would return true
for everything except zero, because nothing is divisible by zero, because division by zero is undefined.
100 is divisible by 42. 1 is divisible by 2. π is divisible by e. etc. I learned this all the way back when I was six or seven years old.
Then along comes Swift and tells me that what I've known for decades is wrong?
I get that there's this motivation to be as pedantically correct as possible. But we also need to account for general human understanding, and the intricacies of number theory and "what division actually means" is not general knowledge. Let's make this language forgiving and name things in such a way that we are teaching people what goes on, instead of making them wonder "wtf why doesn't this work like I expect it to"
ETA: 10 is absolutely divisible by 3, in the context of integers. I get back 3.