Hi,
I'm hoping someone familiar with the compiler/language specification could clarify something for me. The manual states that "user defined type classes will be instantiated exactly once for each tested type and any static code included within them will also be executed once."
However, when I run the following code, it (quite reasonably) seems to test a single type for type class membership twice:
type Printable = generic x
print x
proc check() = echo Int is Printable
proc print(x: Int) = echo "Printing an integer: ", x
proc checkAgain() = echo Int is Printable
check() # prints "false"
checkAgain() # prints "true"
So, in general, when exactly are generic blocks evaluated (or is this an implementation detail)?