I think this is what you're looking for:
    
    
    type My_Interface = object
      foo: proc()
    
    proc to_my_interface(x: int): auto   = My_Interface(foo: proc = echo "int: 
" & $x)
    proc to_my_interface(x: float): auto = My_Interface(foo: proc = echo 
"float: " & $x)
    
    var coll: seq[My_Interface] = @[to_my_interface(2), to_my_interface(3.0)]
    
    for it in coll: it.foo()
    
    
    Run

The output is `int: 2` `float: 3.0`

Reply via email to