r/ProgrammerHumor • • Aug 26 '20

Python goes brrrr

Post image
59.2k Upvotes

789 comments sorted by

View all comments

Show parent comments

7

u/maweki Aug 26 '20

You do know that JS only has a single number type, right?! There is no promotion going on.

0

u/DeeSnow97 Aug 26 '20

And why is that a problem again? Float64 is integer-safe until 253 and in the edge case that you need a larger integer you got typed arrays (Uint64Array and Int64Array). JavaScript's Number type even works seamlessly with bitwise operators (|, &, ^, etc.), truncating itself to int32 in those cases. What are you missing from it?

4

u/maweki Aug 26 '20

Please just read what I replied to.

Next you're going to tell me that 5 + 1.0 should also error because it implicitly promotes an integer to a double.

As there are no two different number types, there is no promotion between different number types.

-7

u/DeeSnow97 Aug 26 '20

Ah, okay, so you were just nitpicking to dodge having to consider the example. Carry on, my bad.

→ More replies (2)