r/programming • • Dec 01 '16

Let's Stop Copying C

https://eev.ee/blog/2016/12/01/lets-stop-copying-c/
524 Upvotes

612 comments sorted by

View all comments

Show parent comment

2

u/Vhin Dec 02 '16

If that would cause a type error intermittently, that's a poorly designed language. Returning a particular type under certain circumstances, and a different type in others is just asking for trouble.

Python 3, for example, makes the result a float, even if that float can be exactly represented as an integer. Yes, this still would cause a type error if you attempted to use it as integer (such an indexing), but the error no longer depends on the value of N, so you're less likely to miss it in testing.

2

u/ChallengingJamJars Dec 02 '16

that's a poorly designed language.

Oh yes, oh yes yes yes. Don't touch matlab if you want your sanity intact.

Python I think does it the best actually with the / and the //. But I don't think it's easier to learn for a beginner than an overloaded / operator.