|
|
|
|
|
by infogulch
3100 days ago
|
|
I think function scope is a good default, and wrapping in an anonymous function and calling it (like your last example) is a simple workaround to get the scope_defer behavior. If it was scope based there's nothing you could do to get func_defer behavior. |
|
I mean, you can convert them into each other. Scoped can do something like this (go+python blended code 'cuz lazy):
but that's a bit more ridiculous / error-prone (though a helper func is obviously possible) than the equivalent IIFE for func -> scope. More explicit, I suppose, but bleh.