5 ms·
interface{} carries runtime type information in its internal double-word (type + pointer) structure, unlike void*.
by Denzel 9y ago
interface{} carries runtime type information in its internal double-word (type + pointer) structure, unlike void*.
- masklinn 9y agoDistinction without a difference, talk about Object if you prefer, the only difference is that downcasts are runtime-checked, it remains a huge hole into the typesystem.
- burntsushi 9y ago> Distinction without a difference This seems pretty misleading to me. Sure, it's a hole in the type system, but not a hole in memory safety, unlike void*. (Even the fact that it's a hole in the type system isn't particularly interesting. Most languages have holes in their type systems, by design. What's important is the amount of use it gets, which is of course somewhat-frequent in Go. Same with void in C, so at the type system level, I agree that there isn't too much to distinguish other than quibbling about frequency of use.)
- deleted 9y ago[deleted]