Re: [go-nuts] Re: Yey another Error Handling proposal

2022-02-16 Thread Ian Lance Taylor
On Wed, Feb 16, 2022 at 4:54 PM Robert Engels wrote: > > I think an “on error goto” construct coupled with defer would be a capable > error handling system. It would eliminate a lot of boiler plate and > duplicative code. See https://go.dev/issue/37035. Ian > > On Feb 16, 2022, at 6:50 PM, R

Re: [go-nuts] Re: Yey another Error Handling proposal

2022-02-16 Thread Ian Lance Taylor
On Wed, Feb 16, 2022 at 3:40 PM Robert Engels wrote: > > I don’t disagree. It is used in C because they don’t have exceptions so you > need centralized handling. Go can be viewed as similar in that respect - but > with some extra limitations and additions. I'd say that the main reason that peo

Re: [go-nuts] Re: Yey another Error Handling proposal

2022-02-16 Thread Robert Engels
I don’t disagree. It is used in C because they don’t have exceptions so you need centralized handling. Go can be viewed as similar in that respect - but with some extra limitations and additions. > On Feb 16, 2022, at 4:53 PM, 'Axel Wagner' via golang-nuts > wrote: > >  > This is golang-nu

Re: [go-nuts] Re: Yey another Error Handling proposal

2022-02-16 Thread 'Axel Wagner' via golang-nuts
This is golang-nuts, though. Not C-nuts. Go's goto statement is significantly different from C's (see Ian's earlier response). And using it for error handling in this manner is extremely uncommon. On Wed, Feb 16, 2022 at 11:12 PM Robert Engels wrote: > Using goto for error handling in C is very

Re: [go-nuts] Re: Yey another Error Handling proposal

2022-02-16 Thread Robert Engels
Using goto for error handling in C is very common. See the Linux kernel. > On Feb 16, 2022, at 3:07 PM, Corin Lawson wrote: > > Hi Vojta, > > Can you please provide some real world examples (e.g. link to open source > project) or a code style guideline that promotes the use of that pattern o

[go-nuts] Re: Yey another Error Handling proposal

2022-02-16 Thread Corin Lawson
Hi Vojta, Can you please provide some real world examples (e.g. link to open source project) or a code style guideline that promotes the use of that pattern of using a goto? I don't believe that it is idiomatic Go. Personally, I can count on one hand the number of times I've seen the usage of