Live data from Hacker News

A Proposal for Adding Generics to Go

blog.golang.org

271–273 of 273 posts

Re: A Proposal for Adding Generics to Go

#271
post #269

Earlier quoted context omitted.

There is a big difference here. The draft is about adding generics to the Go stdlib, not about if it's possible. Is it even possible? Yeah, there are some implementation (e.g. https://github.com/cheekybits/genny ). So Go is not "far behind" C, which also does not have generics (or did I miss something in C11/C17?).

You missed, C17 introduced lightweight generics via _Generic and C2X plans to extend it further.

Tiny correction, _Generic was introduced in C11.

Re: A Proposal for Adding Generics to Go

#272
post #269

Earlier quoted context omitted.

You missed, C17 introduced lightweight generics via _Generic and C2X plans to extend it further.

Tiny correction, _Generic was introduced in C11.

Thanks, that is what happens when I don't cross check my memories. :)

Re: A Proposal for Adding Generics to Go

#273

Earlier quoted context omitted.

can i say T : SomeConstraint ?

in C++ ? sure template void F(T p) { ... } or just void F(SomeConstraint auto p) { ... } like this for instance: https://gcc.godbolt.org/z/hPM38T

cool, can i even add two constraints? or is it limited to one. Oh i see you have include concepts, is that new to c++20 then?
Post reply on HN