Re: [go-nuts] Interface vs first-class function

2016-11-22 Thread roger peppe
>From my point of view, the main difference is that interfaces are strictly more powerful, because you can't dynamically type convert a function type into something different. You can always make an interface from a function (e.g. http.HandlerFunc and the like) but not the other way around. This

[go-nuts] Interface vs first-class function

2016-11-19 Thread Henry
Hi, I am wondering from best practice point of view whether it is better to use interface or first-class function, especially considering that Go encourages the use of small interfaces. Here is an example: type SomethingDoer interface{ DoSomething(data Data) } func PerformWork(doer Somethin