Re: [go-nuts] Why does context.CancelFunc exist?

2016-08-29 Thread Nate Finch
So, just a note... the CancelFunc type doesn't prevent you from passing in any old func(), since those are considered effectively literals (IIRC), so they can be automatically converted to the CancelFunc type. For example: https://play.golang.org/p/QNbVXorlEQ The only time the compiler will

Re: [go-nuts] Why does context.CancelFunc exist?

2016-08-25 Thread Sam Whited
On Thu, Aug 25, 2016 at 2:08 PM, Nate Finch wrote: > The type seems unnecessary. It doesn't actually do anything different than > a regular func(). You are correct that the behavior of the function doesn't differ, but then again behavior isn't necessarily the point of the

[go-nuts] Why does context.CancelFunc exist?

2016-08-25 Thread Nate Finch
The type seems unnecessary. It doesn't actually do anything different than a regular func(). Does it just exist to give a place for common documentation for each of the methods that use it? IMO, the With* functions would be more clear if they didn't use a named type for func(), because now