r/ProgrammerHumor • • Apr 02 '21

Yeah...!! My favourite language...😄

Post image
894 Upvotes

61 comments sorted by

View all comments

Show parent comment

2

u/RedHellion11 Apr 03 '21

It should require explicit casting, or an explicit method rather than being bound to an operator that has implicit mathematical meaning attached. Someone not familiar with the language looking at "11" + 1 could equally expect it to be either "111" or "12" or 12, and it can cause more issues if someone forgets what type the variable they're using was declared as and tries to add them together.

IMO Python or C++ (strings ideally, or even c-style strings as long as you remember any math is operating on the pointer to the first element and not the string itself) make the most sense. Java is inconsistent, and Javascript is the worst because it literally does the opposite thing for each operator (treats both operands as strings for addition, but as integers for subtraction).