On Dec 25, 2020, at 8:48 AM, Henrik Johansson <dahankz...@gmail.com> wrote: > > Both Java and C++ has benefited greatly from generics and most of their > respective communities wouldn't want them gone. I am pretty sure that's what > will happen with Go as well. Can we leave it now before we go from > "corruption" to whatever hyperbole is next?
As Simon Peyton Jones has said, static types have been the most *successful* program verification technique! The more your types can express what you want your programs to do, the more the compiler can check them for you (and reject bad programs upfront). If types can be made more expressive (such as with generics) *without* making programs more incomprehensible (and less fun) it is a win! As for the "simplicity" argument, he simplicity of user programs should be considered even more important than that of the language. That is, can you express your programs simply (without having to build in the kitchen sink in the language)? Clearly there are things such as printing/parsing, serialization/deserialization, copying, collections, counting elements, more general processing of collections, graph algorithms etc. that can benefit from generics. Go has builtin support for a few specific generic functions. Things like len(), copy(), append(), range, new(), make() etc. But notice how range is rather strange. Proper generics support from the beginning might have produced a different kind of range. Ideally user defined types should be as first class as builtin types (including support for generics). Go falls short in this regard (IMHO). -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/375F0FFD-F93C-4A98-B035-E60A0E41F9D5%40iitbombay.org.