zlacker

[parent] [thread] 1 comments
1. __s+(OP)[view] [source] 2025-08-22 13:47:34
1. it avoids a level of indentation until you wrap it in a function

2. mechanic is tied to call stack / stack unwinding

3. it feels natural when you're coming from C with `goto fail`

(yes it annoys me when I want to defer in a loop & now that loop body needs to be a function)

replies(1): >>torgin+C71
2. torgin+C71[view] [source] 2025-08-22 19:43:47
>>__s+(OP)
I think you hit the nail on the head - I think it's the stupid decision on Go lang designers part to make panic-s recover-able. This necessitates stack unwinding, meaning defer-s still need to run if a panic happens down the stack.

Since they didn't want to have a 'proper' RAII unwinding mechanism, this is the crappy compromise they came up with.

[go to top]