Earlier quoted context omitted.
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.
Gen - a generics library for Go
11–20 of 49 posts
Re: Gen - a generics library for Go
#12These 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.
That being said, a systems programming language may not be the right place for FP concepts.
Re: Gen - a generics library for Go
#13Earlier quoted context omitted.
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.
It would be like Java to the Pizza Language: http://en.wikipedia.org/wiki/Pizza_%28programming_language%2...
Re: Gen - a generics library for Go
#14These 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.
That's functional programming for you. It's definitely less efficient, but there are other major advantages. For one thing, given the propagation of immutable data, things can be parallelized effortlessly - look at 'pmap' in Clojure for example. Once you're familiar with the style, it's significantly more concise and readable. That being said, a systems programming language may not be the right place for FP concepts.
Re: Gen - a generics library for Go
#15These 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.
That's functional programming for you. It's definitely less efficient, but there are other major advantages. For one thing, given the propagation of immutable data, things can be parallelized effortlessly - look at 'pmap' in Clojure for example. Once you're familiar with the style, it's significantly more concise and readable. That being said, a systems programming language may not be the right place for FP concepts.
Uhm, what? No it's not.
Haskell has stream fusion, thereby generating assembler that looks a lot like the optimal imperative version.
Re: Gen - a generics library for Go
#16Why call it a library when it's a code generator/compiler?
Re: Gen - a generics library for Go
#17There is a substantial set of changes happening out on this branch: https://github.com/clipperhouse/gen/tree/projection.
… for this reason: https://github.com/clipperhouse/gen/issues/8
Re: Gen - a generics library for Go
#18These 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.
That's functional programming for you. It's definitely less efficient, but there are other major advantages. For one thing, given the propagation of immutable data, things can be parallelized effortlessly - look at 'pmap' in Clojure for example. Once you're familiar with the style, it's significantly more concise and readable. That being said, a systems programming language may not be the right place for FP concepts.
It's good enough for Rust.
Re: Gen - a generics library for Go
#19These 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.
That's functional programming for you. It's definitely less efficient, but there are other major advantages. For one thing, given the propagation of immutable data, things can be parallelized effortlessly - look at 'pmap' in Clojure for example. Once you're familiar with the style, it's significantly more concise and readable. That being said, a systems programming language may not be the right place for FP concepts.
If you're not using a language with Clojure's nifty datastructures, "effortlessly" probably isn't much better than OpenMP.
Re: Gen - a generics library for Go
#20Earlier quoted context omitted.
It would be like Java to the Pizza Language: http://en.wikipedia.org/wiki/Pizza_%28programming_language%2...
Historical tidbit: Pizza is the precursor to Java's own generics implementation (introduced in Java 5), both were written by Martin Odersky who then went on to create Scala.