Quick actions

cmd+k|ctrl+k

Navigation

Languages

Untitled

Snippet info

Language

Nim

Visibility

unlisted

Author

legacy-anonymous

Created

2018-05-07T18:40:09Z

Updated

2018-05-07T18:40:09Z


import typetraits

when true:
  # compiles
  proc something*[T, U: SomeNumber](a: T, b: U) =
    echo("type `a`:", a.type.name)
    echo("type `b`:", b.type.name)
elif false:
  # fails
  proc something*(a, b: SomeNumber) =
    echo("type `a`:", a.type.name)
    echo("type `b`:", b.type.name)
else:
  # fails
  proc something*(a: SomeNumber, b: SomeNumber) =
    echo("type `a`:", a.type.name)
    echo("type `b`:", b.type.name)

something(2'f32, 2'i32)
INFO