> > > You don't. But it's a bad idea. And "I want to make writing bad code > easier" isn't a very convincing argument for a language-change. >
Ok, than I want to - Make it easier to read and follow - Make it possible to handle errors in one place instead of 10 I see you point, and yes, I am also against bubbling errors all the way to the top and let it end in "an unknown error occurred", don't get me wrong! BUT my point is, what do I do with 10 or more sql statements, when it doesn't really matter which one fails why? Some libraries only return error and an explanation as a String (e.g. Postgres), so you don't really have a choice but return anyway. > > You can't. And that's why I am proposing to be a little bit open to new >> ideas. >> > > And how open are you to the idea that good error handling isn't about > writing the least amount of code or bubbling up an error in the most > efficient way, but about *handling errors*? Because you haven't really > replied to that part. > I hope my sentence above explains that. Another idea would be: Look at common go code and see how often people just check for err != nil 10 times in a single function, calling always the SAME error handler. In programming you sometimes simply want to get things done and if it is really not important where exactly an error occurred, a construct like my `watch` comes in handy. > > (and FTR, one of the points I was making is, that this isn't a new idea. > It's proposed fairly frequently) > > >> Every modern language I know of has some sort of try...catch construct. >> > > Go is modern and doesn't have it. So this seems cherry-picked. > Well, I am not saying Go needs it to, I am saying there is a demand for error handling of some sort. C had nothing besides returning -MYERRORCONST, Go can return errors more explicitly, but in its current state it is not saving me much in terms of lines of code compared to C nor does it help with readability. And, I have another argument against your "I want people to deal with their errors". You cannot force people into too much. That's why you see SOOO much Go code which simply copy & pastes long long chains of "if err != nil" statements. Martin -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.