The following program generates an error. Shouldn't it work?
    
    
    proc readMe[T](name: string): T =
      result = 123'u16
    var num = "test".readMe[uint16]()
    # var num = readMe[uint16]("test")
    echo num
    

Here are the error messages: 
    
    
    t.nim(5, 17) template/generic instantiation from here
    t.nim(2, 13) Error: cannot instantiate: 'T'
    

The workaround is to use the commented out line instead.

Reply via email to