Have the closure generator return the resource?

https://play.golang.org/p/16pyo0gh8_s

I'm not sure what you mean by using types instead, or even why you are 
trying to do this. Can you explain more?

Matt

On Sunday, January 21, 2018 at 3:17:20 PM UTC-6, simon place wrote:
>
> 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