[go-nuts] Re: resource cleanup in closure

2018-01-24 Thread 'simon place' via golang-nuts
thanks for the interest, a Done method would be what i was thinking of by the type/object way to do it, rather than the closure way of handing-back/defering a func. but its the isolation i'm thinking about, without some way to get the garbage collector to call code,( like in the original post u

[go-nuts] Re: resource cleanup in closure

2018-01-22 Thread matthewjuran
I assume you know where your interface{} will no longer be used. Why not put in an explicit optimization structure delete there? There's already a New, make a Done or something like that. Matt On Sunday, January 21, 2018 at 6:41:00 PM UTC-6, simon place wrote: > > after a bit of thought, its no

[go-nuts] Re: resource cleanup in closure

2018-01-21 Thread 'simon place' via golang-nuts
after a bit of thought, its not ideal. it would work, but defeats part of the objective, which was for the optimisations to be transparent, having the defer, or callbacks, in the calling function breaks the isolation. i could insert callbacks in the base code which would just be redundant when

[go-nuts] Re: resource cleanup in closure

2018-01-21 Thread 'simon place' via golang-nuts
that might do it, the closures are actually being made by a New(type) call, and i was basically fixated by returning only the new instance (and maybe a error), but no reason not to return a callback destructor. maybe New isn't the right name anymore? the idea is to incrementally add a registry

[go-nuts] Re: resource cleanup in closure

2018-01-21 Thread matthewjuran
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 be