Personally it's not a verbosity issue but a readability issue 99% of the 
time.

if go fmt would just keep the whole if statement on a single line it would 
already alleviate some of the pain of having to read 
a codebase ridden with error handling code.

    if foo,err = DoIO();err!=nil{return err } 


if less painful to read than having to deal with 3 * errorHandlingCode lines

    if foo,err = DoIO();err!=nil{
        return err
     }



which is annoying noise. when it's 5 to 10 lines of that stuff in a 
function.


Le mardi 17 octobre 2017 23:09:33 UTC+2, Nicolas Grilly a écrit :
>
> I just read about Zig, a new programming language designed to replace C.
>
> The error handling philosophy is very similar to Go: control flow in 
> general and error handling in particular is explicit. Zig has even a defer 
> statement inspired by Go ;-)
>
> I noticed that Zig provides a %% operator and %return expression meant to 
> make error handling less verbose:
>
> http://ziglang.org/documentation/master/#errors
>
> I'd be curious to know if something similar would be possible in a future 
> version of Go?
>

-- 
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.

Reply via email to