4 ms·
>...you don't put in language features assuming a good programmer. Interesting design goal.
by zck 17y ago
>...you don't put in language features assuming a good programmer.
Interesting design goal.
- barrkel 17y agoWay to miss the point. Another way of putting it would be that languages should be designed so that there aren't gaping holes waiting for people to fall in. They should rather tend towards a "pit of success" - the easiest way to do things should be the correct way. Error code results make it really easy to ignore errors. That's not a good thing.
- ori_b 17y agoNo, it doesn't in this case. The multiple return values make it impossible to accidentally ignore an error.
- d0mine 17y agoIt requires at least 3 lines for every function call unless you ignore errors. Exceptions allow you to catch them without boiler-plate for each function. if result, ok := func(arg); !ok { // handle error } // process result ..other stuff On the other hand channels & goroutines allow in principle less verbose mode at the cost of additional parameter to every function in a stack. errors := make(chan Error) go handle_errors(errors) // read from errors // ... result := func(arg, errors) // write to errors in case of an error // process result ..other stuff
- deleted 17y ago[deleted]