|
|
|
|
|
by jeremiep
3884 days ago
|
|
Concerning exceptions, I personally hate how Go implemented their error handling. This Quora answer explains it perfectly: https://www.quora.com/Do-you-feel-that-golang-is-ugly Not that I'm a huge fan of exceptions either, but Go is definitely not a reference when it comes to error handling. My personal favorite, by far, is still CL's condition system. Still, I've never had any issues with exceptions in D. Even exceptions thrown in destructors will raise a core.exception.FinalizeError with all the relevant information attached to it. I've worked on large (1M+ LoCs) C++ codebases with exceptions disabled. Threading error codes all over the place, everywhere, is not pretty. Someone always forgets a check somewhere and you then spend 2 weeks figuring out why it crashes. It also pollutes the instruction stream with branches all over the place. D also has assertions, unittests, preconditions, postconditions and invariants built into the language. Also, unless there's actually an exception raised, frame handlers are faster than return code checks (its implemented as 3 MOV instructions per try block instead of test+jumps on every function call). |
|