|
|
|
|
|
by dom96
3310 days ago
|
|
> That said, I completely agree that exceptions are also problematic. As you say, you can never really be sure of what exceptions can be thrown. Some languages have a "throw" keyword, in which you're meant to enumerate the list of possible exceptions; but of course, that's a headache to maintain, and is affected by inner code (such as library code) that might be completely out of your control or review. And when should the "throw" keyword be enforced, at compile time or runtime? And what should happen if the "throw" keyword's list of possible exceptions is violated? This is something that Nim offers via the `raises` pragma[1]. It is enforced at compile-time and in my experience works rather well. 1 - https://nim-lang.org/docs/manual.html#effect-system-exceptio... |
|
[0] http://www.gigamonkeys.com/book/beyond-exception-handling-co...