On Mon, Jan 6, 2020 at 9:18 PM Prabhu Chawandi <prabhuchawa...@gmail.com> wrote:
>
>   I was reading this article @ https://blog.golang.org/laws-of-reflection
>
> Excerpt:
>
> One important detail is that the pair inside an interface always has the form 
> (value, concrete type) and cannot have the form (value, interface type). 
> Interfaces do not hold interface values.
>
> I could not understand it clearly, Can through some clarity with an example?
>
> I tried this and did not give any error.
>
> @ https://play.golang.org/p/Q5jRWp6MF7c

Interfaces do not hold interface values.

What this means is that when you write "a = b" where a and b are both
of interface type, then the value that is in b will be copied to a.  a
will wind up with the dynamic type and dynamic value that were
originally in b.  The dynamic type of a will not become the type of b;
it will become the dynamic type of the value stored in b.

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/CAOyqgcXNqQ6Fa%2BomP0x35ty%2BLB3UZcq%2B%3DFzwzhYwrTzp-aX0Zg%40mail.gmail.com.

Reply via email to