The difference is that go-routine level defers could be added further down the call stack and so could reference objects not visible in the calling "go ...()" scope.
So it could simplify the messy task of cleaning up goroutines (implemented now by eg Context, tomb, etc) No need to identiy goroutines to implement this, as far as I know. Best Scott Le mercredi 11 octobre 2017 01:15:48 UTC+2, kortschak a écrit : > > On Tue, 2017-10-10 at 06:13 -0700, Scott Cotton wrote: > > 1. "defer go" extend defers to work on goroutine exit with > > mechanism just > > like defer, but if we say "defer go f()" > > instead of "defer f()" then we run on goroutine exit. Very big gains > > for > > scaling here IMHO. > > > How is this different to... > > go func() { > defer func() {...}() > ... > }() > > or do you mean (the probably less useful) > > defer func() { > ... > go func() {...}() > ... > }() > > ...? > > As you can see, both of these are already expressible. Maybe you mean > something else? > -- 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.