I've been writing some code where I have nodes in a processing graph that 
need to notify other nodes when something changes.  I'm using callbacks 
(rather than channels, say) because I want everything to be synchronous. 
 It seems like I've got a choice between

type Foo struct {
    Callback func(baz Biff) Boff


type callback interface {
    func(baz Biff) Boff

type Foo struct {
    Callback callback

to represent the callback reference.  Is there a convention (or a good 
argument) for when I should pick one or the other?  Seems like a function 
pointer is more universal (I don't even need an object to be a receiver) 
but maybe an interface is more idiomatic?



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