News for hackers. Stuff that matters.
Re:Golang generics proposal has been accepted by opnitro on Wednesday February 10, 2021 @03:10PM (#26094045)
C may not have generic types, but much of the standard library does use generics, just through the unsafe mechanism of `void*`. Likewise, go already includes some generic code (the array type), it's just treated specially.
Re:Golang generics proposal has been accepted by wahern on Wednesday February 10, 2021 @03:14PM (#26094095)
The equivalent to a void pointer in Go is interface{}. But very little of the C standard library uses void pointers--basically only those interfaces dealing with untyped blocks of memory, such as malloc and free. IME, you see interface{} far more often in Go code than you see void pointers in C code. And C actually has bone fide generics capabilities with _Generic, it's just very simple and manual.
Re:Golang generics proposal has been accepted by wing-_-nuts on Wednesday February 10, 2021 @03:22PM (#26094197)
go's empty interfaces reminded me too much of the bad old days when everyone passed around Objects to java methods. I hated it.
Re:Golang generics proposal has been accepted by Cyph0n on Wednesday February 10, 2021 @03:34PM (#26094381)
void * is very useful as an opaque pointer type. For example, it's used all over the place in collection implementations and user-defined arguments (e.g., callbacks, pthread_create).

It might not be used much in the stdlib (which is relatively small!), but libraries and applications rely on void * heavily in my experience.

Re:Golang generics proposal has been accepted by zwieback on Wednesday February 10, 2021 @03:13PM (#26094087)
For me the desire to use generics shows up once I've invested some time in making fancy types. When I work in C that point is never reached since problems are solved "the C way".

Personally I'm a huge fan of generics but I can understand how the keepers of Go might be reluctant to go down the path of C++, Java and C#.

Re:Golang generics proposal has been accepted by f8o on Wednesday February 10, 2021 @03:35PM (#26094385)
I think that C# has a successfull implementation because it isn't just about syntax sugar. The runtime knows it. Generics+structs allows many optimizations.
Re:Golang generics proposal has been accepted by zwieback on Wednesday February 10, 2021 @04:57PM (#26095342)
So true and portable across languages.