Skip to content

Instantly share code, notes, and snippets.

@stefantalpalaru
Created May 22, 2019 15:37
Show Gist options
  • Save stefantalpalaru/d07d51e2587510946162946352a611eb to your computer and use it in GitHub Desktop.
Save stefantalpalaru/d07d51e2587510946162946352a611eb to your computer and use it in GitHub Desktop.
type_conversion.nim
import typetraits
type
Error1 = object of Exception
# changing the proc into a template avoids the type conversion
proc t1(error: ref Exception) =
echo type(error)
# this prints "ref Exception" instead of "ref Error1":
t1(newException(Error1, "foo"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment