3 ms·
Ha, it's really a matter of taste, because what I like about error codes is how easy and readable it is to write "I want to try three times then fail" blocks.
by sacado2 12y ago
Ha, it's really a matter of taste, because what I like about error codes is how easy and readable it is to write "I want to try three times then fail" blocks.
for i := 0; i < 3; i++ {
res, err = f(arg)
if err == nil {
break
}
}
Writing this kind of behavior with try-catches is rather annoying, the try-catches being leaking all over the code.
About C++, well, I almost agree ; this is my favorite programming language (in the sense it would be the one I'd use if I had to pick only one), but I think it is not the right tool for a lot of tasks (including the ones Go is targeting : servers and sysadmin tools). Java might be better for servers than Go, but for sysadmin tools it clearly sucks (because of startup time, mainly).