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?
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.
To me, the most worrisome thing about the current generics proposal is that
there'll be a constant choice/preference fight between writing
func MyFunc(r io.Reader) error {}
- or -
func MyFunc[T io.Reader](r T) error {}
I hope I am wrong, but I have the feeling the latter looks cooler to a lot
of programmers out there.
On Sunday, December 20, 2020 at 8:38:54 PM UTC+1 Martin Hanson wrote:
> I think people who want generics added to Go should go and program in Java
> or C++.
>
> Adding generics to Go will ruin the beautiful simplicity of the language
> and I haven't found a single example in which adding generics to Go pays
> off.
>
> Even with the examples of having two almost identical functions reverse
> some list, one of ints and one of strings, seriously!? We already have tons
> and tons of open source reusable code that covers all use cases which
> people complain about.
>
> Go was designed without generics purposefully from the start and Go is
> fine just the way it is.
>
> Adding generics means that we're opening the door to the beginning of
> bloating Go with all the crap that Java, C++ and all the other complex
> languages has gotten over the years, and Go was designed specifically
> without that clutter. So we add generics, then what? Classes?
>
> Adding generics to Go ruins that beautiful simplicity that went into the
> design and the added complexity just isn't worth it! The standard library
> have managed just fine without generics and so have we!
>
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/golang-nuts/1fe5535e-9c1e-4fba-97da-1f840a284c82n%40googlegroups.com.