On Tue, Dec 22, 2020 at 9:48 PM Ian Lance Taylor <i...@golang.org> wrote:

> On Tue, Dec 22, 2020 at 1:24 AM Markus Heukelom
> <markus.heuke...@gain.pro> wrote:
> >
> > Why not issue a poll on generics, was this ever done? (I could've missed
> it, I  am only following Go ~2 years). While the community has a vote in
> accepting/rejecting the current generics proposal, the community was never
> (really) asked if generics is desired in the first place and especially
> what the scope of generics should be. Is that correct?
>
> I don't know of a poll specifically about generics.  But for the past
> several years we've done a Go community survey, and every year there
> is significant support for adding generics to the language.  For
> example, although the results of the 2020 survey haven't been
> assembled yet, you can see the results of the 2019 survey at
> https://blog.golang.org/survey2019-results.  In that survey when asked
>



> "Which critical language features do you need that are not available
> in Go?", 25% of the survey takers answered the question, and of those
> 79% mentioned generics.  Previous years also showed support for adding
> generics.


Thanks for this, that's actually a lot higher than I would expect.

It could be of interest to see the percentage of people who answered
"generics" split by "years of any coding experience" and "years of go
experience" (graph 2 and 3 in the blog post).  It may be helpful in this
discussion for people to see if  their "peers" requested generics.

I am not against generics, it can definitely be useful in some cases,
although I too certainly worry quite a bit about the mess it can cause in
other languages. Generics is a great tool for over-engineering.


Of course this isn't definitive, since there was no clear
> way for people they say that do not want generics.  But it's also not
> definitive in a different direction, which is that by and large people
> who don't currently use Go didn't take the survey, and probably some
> of them would also want generics.
>
> So while Go is not and never has been a poll-driven language, I think
> it's reasonable to say that there is real support for adding generics.
>
>
> > Another thought:  there are many popular, type-safe programming language
> with generics already. So if you really need generics, there's plenty to
> pick from. There's not that many  without, I can only name Go and C. So if
> generics is added to Go there's far less choice to pick a modern type-safe
> language that doesn't have generics. It's a feature that makes Go quite
> special.
>
> Actually, C does have generics, through the preprocessor macro
>

mechanism.  It's difficult to write, but it does provide the same kind
> of functionality that would be available in Go if we added generics.

For example, here is a compile-time-type-safe vector implementation in
> C:
>
>
> https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/vec.h;h=cb871124ce2241402af05e4697a5e28904c462fb;hb=HEAD
>
> https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/vec.c;h=85274c4e00c202e680761cef516bd17bb58b6261;hb=HEAD
>
> 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/CAMoB8rWJ%3DaOYYruQoJBrKY5NPGQHPdQZ8wSV%2BHSKMPSLofUrnw%40mail.gmail.com.

Reply via email to