i wrote the code below hoping that defer() would run when a funcs context 
was lost, not just when it ended.(which, without using closures, would 
always be the same thing, i think.)

https://play.golang.org/p/HBrmBOkK1zJ

as can be seen it doesn't, which begs the question;

"how do you clean up external resources used in a closure?"

this problem came up when i was incrementally developing code containing 
closures, it seems at this point i am forced to switch everything to use 
types instead! which seems to make use closures at all a bit problematic. 

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to