On Thursday, October 13, 2016 at 8:52:14 PM UTC+8, Jan Mercl wrote:
> On Thu, Oct 13, 2016 at 2:42 PM <di...@veryhaha.com <javascript:>> 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

So "y must implement both I and io.Reader" means short form of "the dynamic 
type of y must implement both I and io.Reader"?
My brain really can't accept this short form.

And in that example, it gives people the impression y is nil. I really 
think it is a bad example.

I feel that comment (and that example) is very not professional for these 
1. y is a value of type I, 

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