4 ms·
> I wonder if over time, Golang will pick up more type features like Java and other languages have. I hope it doesn't pick them up like Java did. When Java w
by SeanLuke 6y ago
> I wonder if over time, Golang will pick up more type features like Java and other languages have.
I hope it doesn't pick them up like Java did.
When Java was considering generics, there were two major proposals out there. Sun decided on easily the worst one: type erasure. Now we're stuck with it.
When Java was considering closures, there were two major proposals out there that I recall [one being to get rid of Java's broken local variable closure semantics]. Sun (Oracle? forget) again picked the worst of the two proposals. Now we're stuck with a real monstrosity.
Java has an amazing history of picking the wrong way to do things and permanently saddling developers with it.
- wtetzner 6y ago> When Java was considering generics, there were two major proposals out there. Sun decided on easily the worst one: type erasure. Now we're stuck with it. Though using type erasure may have made the JVM a better target for other languages.
- hota_mazi 6y agoType erasure was the best of these options, and it's one of the main reasons why Java became even more successful than it already was, and also the main reason why there are so many languages created on top of the JVM (as opposed to .net, which supports reified generics, which complicates enormously writing languages on it, especially for interop reasons). More details: https://www.beust.com/weblog/erasure-vs-reification/ https://www.beust.com/weblog/erasure-vs-reification/
- mauricioc 6y agoSince type erasure was mentioned, it's worth noting that Philip Wadler (of Haskell fame) was involved both in the design of Java generics [0] and of Go generics [1]. (Perhaps I should clarify that I don't have a strong opinion on type erasure.) [0] https://homepages.inf.ed.ac.uk/wadler/gj/Documents/gj-oopsla.pdf https://homepages.inf.ed.ac.uk/wadler/gj/Documents/gj-oopsla... [1] https://arxiv.org/abs/2005.11710 https://arxiv.org/abs/2005.11710
- kaba0 6y agoAny objective reason for thinking either feature is bad?