On Thu, Oct 13, 2016 at 2:42 PM <d...@veryhaha.com> wrote:

> I don't understand the comment of the last line. Can someone explain it
for me?

"r has type io.Reader" means that the type if expr.(T) is T.

"and y must implement both I and io.Reader"

y is either nil or it implements I, because that's how it was declared and
nothing not implementing I can be assigned to it. The dynamic type of y can
implement any number of interfaces, so it can implement both I and
io.Reader. The later is checked at run time when the type assertion
expression y.(io.Reader) is actually evaluated.

-- 

-j

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