Thanks

This still leaves the question: how can I avoid implementing each int procedure 
for int64 also,

i.e. how can I ensure that the integer version of double is called for i 
without uncommenting the int64 version?
    
    
    converter lenientInt64toInt*(x: int64): int =
        when sizeof(int) == 4:
            {.error: "int64 to int conversion is unsafe on 32-bit platforms".}
        else:
            int(x)
    
    proc double[T](x : T) : T = x
    
    proc double(n : int) : int = 2 * n
    
    #proc double(n : int64) : int64 = 2 * n
    
    let i = 1'i64
    
    echo double(i)  # outputs 1
    
    
    Run

Reply via email to