In Go, you could pass a method value around so that the method can be 
invoked later on a pre-determined receiver, e.g.

func (a *A) foo() bool { ... } 

func bar(f func () bool) {
    if f() {
        ...
    }
}

func main() {
    a := &A{ ... }
    bar(a.foo)
}


You could also create a method expression so that the receiver can be 
supplied at actual call time, e.g.

f := (*A).foo
boolVal := f(a)


But I couldn't find a way to bind a receiver to a method expression, such 
that the resulting method value can be invoked at a later time. Would this 
be a useful addition to the language? Or did I miss something?

--
Bryan

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