Gen - a generics library for Go
clipperhouse.github.io
Gen - a generics library for Go
1–10 of 49 posts
Re: Gen - a generics library for Go
#2Here 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.
Re: Gen - a generics library for Go
#3Why call it a library when it's a code generator/compiler?
Re: Gen - a generics library for Go
#4Here 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
#5Why 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.
Re: Gen - a generics library for Go
#6This looks similar to an older generics system for Go, `got` (GO Templates). Got was pretty cool, but Go 1.0 broke it due to the parser getting stricter.
Edit: found it: https://github.com/droundy/gotgo
Re: Gen - a generics library for Go
#7Why 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
#8These 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
#9Thanks 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
#10Here 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.