On Sun, Jun 9, 2019 at 9:48 AM Houzuo Guo <guohou...@gmail.com> wrote:
>
> Given a function type: type Fun func()
>
> And two structure methods that satisfy the function type:
>
> type Alpha struct {
> }
> func (a Alpha) funA() {
> }
>
> type Beta struct {
> }
> func (b Beta) funB() {
> }
>
> At runtime, is there a way to tell whether a non-nil `var f Fun` is assigned 
> to an arbitrary instance of structure Alpha, or Beta? Can reflection help in 
> this case?

I'm sorry, I don't understand your question.  funA and funB are
methods.  You can't assign to a method.  And the structs have no
fields, so you can't assign to that either.  So I'm not sure what you
mean.

That said, I suspect the answer to your real question is "no."

Ian

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAOyqgcXpOUraiidjhem%3DECeuj8BWev%2BcsNCopH0COc978ehMBw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to