3 ms·
Indeed, Go goes much further than Java before 1.5, since it does allow you to specify types for maps, lists, and channels. Still, it would be nice if you wrote
by danieldk 14y ago
Indeed, Go goes much further than Java before 1.5, since it does allow you to specify types for maps, lists, and channels.
Still, it would be nice if you wrote, say a matrix package, that you could simply specialize data structures for double or single precision. You see such shortcomings in the standard library as well, for instance for the ParseFloat string conversion functions in strconv, you have to specify the number of bits of the data type. It would be much better if the return type was some generic type for fractional numbers. Now, if you want to have a single precision double, you have to specify that you want to have a 32-bit float and then cast it to a float32.
That said, I believe that Go needs generics, but I'd rather see them implement them properly than to rush.