Re:Channels in Golang
by computerex on Sunday December 25, 2016 @07:56AM
(#13253970)
Can you explain why the empty interface would be a subtype of [] int and not the other way around? Intuitively, I think it's the other way around, as every type implements interface{}.
[ Parent
| on HN ]
Re:Channels in Golang
by burntsushi on Sunday December 25, 2016 @09:08AM
(#13254116)
I guess neither direction is especially intuitive because structural typing makes the relationship a bit strange. In both cases, it's easy to show a contradiction. `interface{}` can't substitute `int` in `[]int` and `int` can't substitute `interface{}` in `[]interface{}`.