Live data from Hacker News

Gen - a generics library for Go

clipperhouse.github.io

1–10 of 49 posts

Re: Gen - a generics library for Go

#4
post #2

Here is someone trying to come up with a good solution for generics, rather than simply complaining it don't exist. I am thankful for the effort.

Good? It's an ugly hack with limited functionality (due to Go's design, not the developers' skill and good will). A good solution would be forking the reference compiler and doing a proper implementation.

Re: Gen - a generics library for Go

#7
post #5
post #3

Why call it a library when it's a code generator/compiler?

I would argue this is a new language which just happens to compile to go.

Actually it's a code generator with a library of functions it can generate. This is how the "generics" are implemented: https://github.com/clipperhouse/gen/blob/master/templates.go

Re: Gen - a generics library for Go

#8
These higher-order functions are a very inefficient way to write loops in Go. When you chain them you will end up with multiple sequential iterations instead of only one. Sort should not allocate and return a new slice, it's better to sort in-place, etc.

Re: Gen - a generics library for Go

#9
Thanks for your effort. This is not about the library. Your site's mobile version is kinda broken. The left menu thingy always remain in the site and you can't read the main context. This happened to me on my Android Firefox Browser.

Re: Gen - a generics library for Go

#10
post #2

Here is someone trying to come up with a good solution for generics, rather than simply complaining it don't exist. I am thankful for the effort.

Good? It's an ugly hack with limited functionality (due to Go's design, not the developers' skill and good will). A good solution would be forking the reference compiler and doing a proper implementation.

The library is Go. What you're suggesting seems to be extending Go so that it becomes some other language derived from Go. Extending Go might make for a cleaner and/or better generics solution but if you have to have customized compiler to run the code then you're no longer running Go.
Post reply on HN