What's the accepted way to ensure same integer behavior between 32-bit and 64-bit Julia?

I also didn’t know this method of include. Steven’s solution (using macroexpand) works for me. Actually, you could do it in this alternate way using a currently non-public SwapLiterals function (I should make a public API for this eventually):

swapper = SwapLiterals.literals_swapper([Int => Int64])
include(swapper, "path/to/example.jl")

This seems to be faster than invoking directly @swapliterals on each expression (@swapliterals has to do some work to transform its arguments into the swapper object above for each expression of the file).

3 Likes