On Fri, Jan 1, 2021 at 12:52 PM da...@suarezhouse.net <da...@suarezhouse.net> wrote: > > Wow, you are awesome! I think this shows that generics "can be" fully hidden > from view of typical users if desired. In other words, the typical user > wouldn't need to know they exist whereas more advanced users can leverage to > minimize code duplication. My question is: should that be a goal or is it a > non-goal? > > I see what you are saying in terms of might be less readable but if I put > myself in the shoes of someone that has never seen anything about generics > and this example works (which it does), potentially stating it as a goal > would alleviate concerns on losing simplicity? e.g. the library writer can > always make the effort to hide the usage of generics if the intended audience > is the general public vs. internal code while the internal code would still > have the same compile time checks, reduction of duplication, etc. > > Thoughts?
It is an explicit goal that it be possible for the user of a package to not have to fully understand generics even if the package itself uses generics. It's not entirely clear how well the design draft succeeds at that, but I think it does reasonably well. There is some brief discussion at https://go.googlesource.com/proposal/+/refs/heads/master/design/go2draft-type-parameters.md#complexity . Ian -- 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/CAOyqgcUpVZw394N_88s%3DgfcL7Ayrs%3DC1S53zmRQrDkk43r5kPw%40mail.gmail.com.