Live data from Hacker News

Go generics are not bad

lemire.me

31–40 of 305 posts

Re: Go generics are not bad

#32
post #30

"not bad" is a weird bar to cross for a language that: 1. decided generics is not needed 2. went on for a decade 3. implemented a version of it that is not performance-sensitive 3.5. $$ by google

[deleted]

Re: Go generics are not bad

#33

This is good to hear. There's something like a cognitive bias that makes me leary of genetics (in any language). Once you have some cross cutting feature, generics or object orientation, or in functional programming, those functions of type 'a->'a, or assembly language address modes, people get bogged down by trying to make everything in their work generic or object oriented or "orthogonal". Lemire's example is relev…

> those functions of type 'a->'a

Polymorphism. But note that there is only one function of type 'a->'a for all 'a, and that's the identity function.

Re: Go generics are not bad

#35

This is good to hear. There's something like a cognitive bias that makes me leary of genetics (in any language). Once you have some cross cutting feature, generics or object orientation, or in functional programming, those functions of type 'a->'a, or assembly language address modes, people get bogged down by trying to make everything in their work generic or object oriented or "orthogonal". Lemire's example is relev…

Premature abstraction?

'Premature Abstractulation'

I'm sorry. I had to do it. Ban me.

Re: Go generics are not bad

#36
The title says Go generics are not bad, and then in less than a page this guy only compared one use case with Java's generics.

I'd expect a CS professor to be able to add a little more rigor in a blog post but I guess everyone is losing patience to read and write these days, even for the supposedly erudite.

Re: Go generics are not bad

#37
post #15

This is like the most cherry-picked example that could've been chosen. Java can't do this because the primitive types are not objects. Mentioning the performance of this is hilarious because 1. it's Daniel Lemire, he should know better and 2. the performance of pretty much every other thing that uses generics is terrible because of gcshapes being passed everywhere and 3. Java literally has a JIT to make generics fast…

How can Go does it even worse that Java where generics implementation is the worse of all modern language with type erasure. Java is way worse than Go on that aspect.

Type erasure has little to do with the power of generics at the language level. Haskell, with one of the most powerful type systems around, erases types to a greater extent than Java does (concrete types are still encoded in JVM bytecode, Haskell erases everything).

Re: Go generics are not bad

#38
post #33

This is good to hear. There's something like a cognitive bias that makes me leary of genetics (in any language). Once you have some cross cutting feature, generics or object orientation, or in functional programming, those functions of type 'a->'a, or assembly language address modes, people get bogged down by trying to make everything in their work generic or object oriented or "orthogonal". Lemire's example is relev…

> those functions of type 'a->'a Polymorphism. But note that there is only one function of type 'a->'a for all 'a, and that's the identity function.

Not quite. This also has the type ‘a -> ‘a:

def nitpick(x): throw “foo”

Re: Go generics are not bad

#39

Earlier quoted context omitted.

Most things first exist, then exist and are good. We've seen the start of Go generics existing, but we haven't seen them be as good or as fast as they will ever be. Five years from now, Go will still exist. The implementation of generics in that future version of Go is likely to be much faster and better than what we currently have. Put a different way, "Generics are slow in Go v1.18"

Someone will read a blog post about slow generics, ignore how it evolves, and tell every coworker for then next 10 years that go generics are slow

"Java is slow"

Re: Go generics are not bad

#40

This is like the most cherry-picked example that could've been chosen. Java can't do this because the primitive types are not objects. Mentioning the performance of this is hilarious because 1. it's Daniel Lemire, he should know better and 2. the performance of pretty much every other thing that uses generics is terrible because of gcshapes being passed everywhere and 3. Java literally has a JIT to make generics fast…

You should write a comment on his post - he will probably respond.

I could but it would probably starve him of the context of people disagreeing with me
Post reply on HN