News for hackers. Stuff that matters.
Re:Generics enabled by default in Go tip by c-cube on Saturday August 21, 2021 @11:34AM (#28257810)
Not in the commonly understood sense of "generics", no. You get to switch on a type, but you don't have generic functions or types. A reusable, type-safe Vec or HashMap are still not possible in C...
Re:Generics enabled by default in Go tip by pjmlp on Sunday August 22, 2021 @06:17AM (#28264268)
Kind of, now that typeof is going to be part of the language, that coupled with the preprocessor, does allow exactly that.

Although in typical C fashion is a bit of kludge.

Re:Generics enabled by default in Go tip by c-cube on Sunday August 22, 2021 @02:04PM (#28267869)
"coupled with the preprocessor" is a bit of a cop-out :-). Do you have a concrete example of what typeof would enable? Like a basic implementation of a vector type?
Re:Generics enabled by default in Go tip by pjmlp on Sunday August 22, 2021 @03:23PM (#28268612)
True, it is basically //go: generate, before Go was born.

Here is an example, https://codereview.stackexchange.com/questions/101816/generi...