3 ms·
> exception is just a type of return value No, they are part of the syntax. The compiler (in Nim and other languages) can track which exceptions are allowed to
by nimmer 9y ago
> exception is just a type of return value
No, they are part of the syntax. The compiler (in Nim and other languages) can track which exceptions are allowed to be raised in a procedure and which aren't at compile time:
https://nim-lang.org/docs/tut2.html#exceptions-annotating-procs-with-raised-exceptions https://nim-lang.org/docs/tut2.html#exceptions-annotating-pr...
- kskskuejej2 9y agoAnd golang knows what type of error can be returned at compile time. type FatalError error func foo() FatalError {}
- dom96 9y agoNim does too. The exception tracking is performed at compile time.