Re: How do you gracefully stop the compiler?

2018-08-11 Thread emekoi
`static: echo "compiling..." proc display[T](message: T) = when not (T is string): {.fatal: "T is not a string".} echo message # works display[string]("hello") # fatal error, compilation aborted # display[int](5) ` Run

Re: How do you gracefully stop the compiler?

2018-08-11 Thread sflennik
The answer to my question in another thread lead to the answer to this one. Replace the "compile error" line with: static: doAssert(false, "T is not a string") Run The the doAssert will run at compile time.

How do you gracefully stop the compiler?

2018-08-11 Thread sflennik
How do you gracefully stop the compiler? You can specify garbage to stop it, but is there a better way? static: echo "compiling..." proc display[T](message: T) = when not (T is string): compile error: "T is not a string"