3 ms·
It's true that defer is more powerful at function scope. You can always recover block scope with an unnamed func. But it doesn't fit with normal lexically scop
by br1 9y ago
It's true that defer is more powerful at function scope. You can always recover block scope with an unnamed func. But it doesn't fit with normal lexically scoped constructs. You get gotchas.
I would love to be able to explicitly affect other scopes as you mention, for example to define two classes at the same time.