>> Now imagine that T=int8 Generic struct always has the same size only because it uses pointers.
type S<T> struct { elem T arr []T } Is the same as the following struct. type S<T> struct { elem unsafe.Pointer arr []unsafe.Pointer } This is because it is designed to be universal. You may ask: Why use "unsafe.Pointer" instead of the "interface{}?". My answer is that the "unsafe.Pointer" has less size (). Size of the "unsafe.Pointer" is a size of "uintptr". And size of the "interface{}" is a size of the following struct: struct emptyInterface { typ *rtype data unsafe.Pointer } This means, if the "emptyInterface" (a.k.a "inteface{}") is universal structure, and "inteface{}" uses "unsafe.Pointer" for "data" field then why other universal (parametrized) type (eg. generic struct) should use other approach? If the information about the type arguments must be strored directly into the "rtype" structure then why duplicate them in each field? The "duplicate them" means use "interface{}" instead of the "unsafe.Pointer". Moreover, it is easier to work with the "unsafe.Pointer" than with the "interface{}". The "interface{}" in Go language means a "boxed" value. This is convenient, but it adds overhead in comparison with the "unsafe.Pointer". -- 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.