nothrow by default

Ola Fosheim Grøstad ola.fosheim.grostad at gmail.com
Sun Jan 5 19:53:59 UTC 2020


On Sunday, 5 January 2020 at 15:02:59 UTC, Johannes Pfau wrote:
> This certainly needs to be considered, however: Some languages 
> such as go (server!) and C++ with std:error decided to go for 
> error codes for error handling.

What is "std::error"? If you mean "std::error_code" then it is 
for wrapping OS error codes like the ones from Unix. (You can 
throw it if want...)

The error handling regime in Go is not something anyone should 
copy. The language lacks features that makes code maintainable 
over time. Lots of pointless error-handling boilerplate noise. 
Also, they didn't do it because of speed, Go is not that fast. 
They did it for no scientific reason, just their own (bad) taste, 
but they later found that they had to add the awful hack that 
resembles exceptions, but is a lot more ugly and clunky. Although 
you can hack it to do what you want, in a rather type-unsafe way. 
So I do that, but Go is the error handling scarecrow of modern 
languages... You don't want to write big programs in Go.

Go I useful for small web services because it has a decent 
runtime, stable language design, few compiler bugs, decent 
web-service libraries and cloud support. However, the language 
itself is pretty primitive (for no good reason).



More information about the Digitalmars-d mailing list