3 ms·
The answer is lack of generics in all previous versions of Go. There's no way to express a generic interface to have methods for map or slice (which are not int
by esprehn 4y ago
The answer is lack of generics in all previous versions of Go. There's no way to express a generic interface to have methods for map or slice (which are not interfaces, but compiler magic instead). All the operations on builtin types must be implemented as globals handled by the compiler.
- hesdeadjim 4y agoBeen using Go since the early days, and 'make/append' always felt clunky and out of place. Especially when you could just use literals for a map/slice...
- chimeracoder 4y ago> Been using Go since the early days, and 'make/append' always felt clunky and out of place. Especially when you could just use literals for a map/slice... Most people do use the literals for creating the empty map/slice. "make" is mostly useful when specifying a known length or capacity, which saves unnecessary allocations and improves performance.