Re: [go-nuts] recommend that error and panic auto coverting

2018-11-22 Thread Liam
A predefined handler which produces a panic appears in item (L) of Requirements to Consider for Go 2 Error Handling ...which is a comprehensive survey of error-related issues, most of which aren't mentioned in the draft

Re: [go-nuts] recommend that error and panic auto coverting

2018-11-22 Thread Michel Levieux
I will agree with your point. Even currently, when other ways exist, it highly not recommended to use recover. The only time I've had to use it was in systems that needed to be highly available and that could not break at all, even on bugs or implementation failures. This is a particularly rare

Re: [go-nuts] recommend that error and panic auto coverting

2018-11-22 Thread 'Axel Wagner' via golang-nuts
You're right, there is none. IMHO, making recovering from panics easier should be a none-goal. Panics should be reserved for irrecoverable violations of invariants (i.e. bugs) and not recovered, in the general case. The main reason panic/recover is useful today is that it allows to elide some

Re: [go-nuts] recommend that error and panic auto coverting

2018-11-22 Thread Michel Levieux
Sure it is, I think it's part of the same problem, but (mainly for the second example) it's more complementary than it is redundant. I haven't seen a possibility for "quick recovering" in go2 draft design concerning error handling. If there is one, could anyone point it out? Le jeu. 22 nov. 2018

Re: [go-nuts] recommend that error and panic auto coverting

2018-11-22 Thread 'Axel Wagner' via golang-nuts
This seems very similar (almost identical, safe for the choice of words maybe) to the Go 2 error handling draft design . On Thu, Nov 22, 2018 at 11:32 AM Michel Levieux wrote: > I do like the idea, but

Re: [go-nuts] recommend that error and panic auto coverting

2018-11-22 Thread Michel Levieux
I do like the idea, but the form looks strange IMO. I'd rather make the "Must" convention a new keyword for the first example, and another one for the second (though I don't see a clear keyword for that). For a panic on error you'd write : data := must error_func() Maybe the "try" keyword would

[go-nuts] recommend that error and panic auto coverting

2018-11-22 Thread 'yinbingjun' via golang-nuts
For an error function: data, err := error_func(…..) can be changed to panic style: data := panic error_func(……) And for a panic function: data := panic_func(……) can be changed to error style: data, err := error panic_func(…...) -- You received this message because you are subscribed to