On Wednesday, 15 January 2014 01:44:32 UTC, Stefan Karpinski wrote: > > It's difficult to use 32-bit integer arithmetic in Julia on a 64-bit > machine, but you usually don't want to. It's sometimes a performance hit > like it is here, but that's pretty rare, and 2 billion really just isn't > big enough for a lot of pretty mundane things you might use integers for > (Bill Gates can't represent their net worth with a 32-bit int!). >
I can see the sense in that, but couldn't you argue that if someone has explicitly declared a 32-bit int, it is probably for performance reasons, so they would probably prefer to think about the overflow issues in exchange for the performance boost? It just seems strange to forbid an operation that someone already has to opt into, especially when Julia is aiming to support highly optimized libraries with tight loops like the one benchmarked above. Though I suppose it would be a bit difficult to deal with the interaction between integer literals and 32 bit operations, without causing lots of accidental type promotion.