4 ms·
(The Java approach.) Box everything implicitly. Boxing and generics are orthogonal concepts. Also: does auto-boxing even make sense in Go? Between the fact th
by pcl 12y ago
(The Java approach.) Box everything implicitly.
Boxing and generics are orthogonal concepts.
Also: does auto-boxing even make sense in Go? Between the fact that Go is statically compiled and that there isn't an int / java.lang.Integer dichotomy to resolve, I would assume that the compiler could just do whatever it needed to with primitives, regardless of generics.
- masklinn 12y ago> Also: does auto-boxing even make sense in Go? Yes, and already happens: interfaces cause wrapping of their content[0] and go does basic escape analysis and automatically allocates things which escape a function on the heap rather than the stack[1] [0] https://golang.org/doc/faq#nil_error https://golang.org/doc/faq#nil_error [1] https://golang.org/doc/faq#stack_or_heap https://golang.org/doc/faq#stack_or_heap