Wojciech, you're right: It'll effectively work as a "catch" (or "recover"); 
e.g. something like:

defer func() {
    if err := recover(); err != nil {
        fmt.Printf("ERROR: %v\n", err)
    }
}()

The only difference is that we wouldn't have to "throw" or "panic". The 
compiler would just "watch" the "behaviour" of the error variable.

But, hey, I think we're all very happy with the options we have to handle 
errors in Go: we have the "error" keyword AND panic/recover! That's great!

Also, I think we're just wondering whether a "syntactical sugar" is worth 
in Go or not (speaking for myself, of course).

Best wishes.
Dorival

On Tuesday, September 5, 2017 at 11:07:12 PM UTC+10, ohir wrote:
>
> On Tue, 5 Sep 2017 00:20:09 -0700 (PDT) 
> Dorival Pedroso <ped...@cpmech.com <javascript:>> wrote: 
>
> > I realised I've written 569 "if err != nil": 
> > And I've written 231 error messages 
> > And I have a feeling that I've done only 20% of the error messages... 
>
> Factor 2,46 so far. 
>
> It directly *proves* that any 'watch' construct would get us soon to 
> 'spooky 
> action at distance' at massive scale. What is now written just after call 
> would get a trip to some distant watch block and be 'cased' there. 
>
> So why call it 'watch' at all? It would be simply a 'catch' :) 
>   
> BAD. 
>
> > See the messages 
> > here: https://gist.github.com/cpmech/d2e36dcbe277cd72605f3732d79c798b 
>
>
> -- 
> Wojciech S. Czarnecki 
>  << ^oo^ >> OHIR-RIPE 
>

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