Closed zevv closed 3 years ago
@zevv what conclusion did you come to about this?
That I was not smart enough to properly read the manual.
https://nim-lang.github.io/Nim/manual.html#generics-type-classes
"Whilst the syntax of type classes appears to resemble that of ADTs/algebraic data types in ML-like languages, it should be understood that type classes are static constraints to be enforced at type instantiations. Type classes are not really types in themselves, but are instead a system of providing generic "checks" that ultimately resolve to some singular type. Type classes do not allow for runtime type dynamism, unlike object variants or methods"
I'm not even sure what a proper title for this would be, sorry.
I am not sure if this is a bug or if I understand the manual wrong. The following fails to compile:
The error being:
However, if I change the proc signature to his, things are just fine:
Also works: