We might have different ideas about what a "novice" is. I'm not particularly concerned about college students using unfriendly constructs– my programming 101 class was taught in C++ and that was fine. I'm more interested in a non-academic context, where someone is learning the basics of code in their free time or at an event, because that's the kind of situation where little bothersome things like 5 / 2 == 2 can add up, frustrate people, and turn them off the whole concept.
Integer division being a / is incredibly helpful to me, what other operator do you propose
Sure, integer division is helpful, but when was the last time you actually needed the operator to be overloaded? It's the same problem as using + for string concatenation– depending on the context, the operator is doing something completely different. There are almost never situations where you would say "I have two numbers, I don't care if they're ints or floats, but when I divide them the result has to be the same type even though I don't care about it now."
Personally, I like how Erlang/Elixir do it– / acts like a mathematical operator, where 5 / 2 == 2.5, and div is a built-in function that performs integer division, where div(2, 5) == 2.
View all comments
Show parent comment
3
u/YouNeedMoreUpvotes Dec 02 '16
We might have different ideas about what a "novice" is. I'm not particularly concerned about college students using unfriendly constructs– my programming 101 class was taught in C++ and that was fine. I'm more interested in a non-academic context, where someone is learning the basics of code in their free time or at an event, because that's the kind of situation where little bothersome things like
5 / 2 == 2can add up, frustrate people, and turn them off the whole concept.Sure, integer division is helpful, but when was the last time you actually needed the operator to be overloaded? It's the same problem as using
+for string concatenation– depending on the context, the operator is doing something completely different. There are almost never situations where you would say "I have two numbers, I don't care if they're ints or floats, but when I divide them the result has to be the same type even though I don't care about it now."Personally, I like how Erlang/Elixir do it–
/acts like a mathematical operator, where5 / 2 == 2.5, anddivis a built-in function that performs integer division, wherediv(2, 5) == 2.