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 SomethingDoer){
   //...
}

Or 

type SomethingDoer func(Data)

func PerformWork(doer SomethingDoer){
   //...
}

Is there some sort of a guideline when to use one vs the other? They seem like 
redundant features to me.

Thanks

Henry

-- 
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