On Dec 31, 2020, at 11:54 AM, 'Axel Wagner' via golang-nuts
<[email protected]> wrote:
>
> On Thu, Dec 31, 2020 at 5:46 PM robert engels <[email protected]> wrote:
> I’ll state for the record again, I was originally very dismayed that Go did
> not offer generics - after developing with it for a while that is far less of
> an issue to me than the error handling.
>
> Just to illustrate that the plural of "anecdote" isn't "data": I was
> originally very vehemently opposed to generics in Go, but after using Go for
> a bunch of years, I've been missing them often enough that I think they
> provide a net-benefit (despite my criticism of this specific design).
>
> Generics just isn't a "if you use Go long enough you learn they are not
> important" thing.
This is more or less my position on it as well. From time to time, I find
myself thinking "I could do this easier and more elegantly in C++", which is
never a great place to be. The lack of generics mostly causes me to create
repeated, identical code for things that are almost the same (e.g. bitfield
code for uint32 and uint64 variants) which is invariably more error prone and
just isn't great.
I've been programming in C and C++ for about 25 years, which is not nearly as
long as some people here, but it's enough to say that I understand the
tradeoffs involved with preprocessor macros and templating. C++ is not
generally worth using without the STL, and Java usability was honestly greatly
improved with the addition of generics (until this year, I hadn't done any
serious Java work since before they were added, and I find myself liking it a
lot better; recall that before generics, Java used an interface{}-like or void
*-like approach with Object, which was not very fun).
I'm not going to waste any more time with the increasingly hostile folks who
are denying the existence of real-world use cases in the face of real-world use
cases, but I will gladly discuss the ways in which a generics scheme will make
my real-world problems a lot smaller.
- Dave
--
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/67FC3C39-496B-4931-9789-61BFAC5D9777%40gmail.com.