Hacker News new | ask | show | jobs
by yahyaheee 2368 days ago
Scalas insane generic type system would be an example of them going wrong. The current proposed Go method seems fairly reasonable.
2 comments

I'll give an example of the Scala type system: let's define combining 2 integers as adding them together, then combining 2 lists of integers will give a new list where an element is the result of combining of 2 elements in the given 2 lists. Now we can make it a bit more generic: if a type A has a method combine, then 2 lists of elements of type A can be combined together to give a new list of which each element is from combining 2 elements in the 2 given lists.

How do you implement it in Go? It can be done in Java with generics, but if I make the problem a little bit more generic, a little bit more complicated, then I don't think Java can do it.

It would depend on how generics are implemented in Go, with the current proposed implementation that would be possible. Without generics today you could use an interface, wouldn't be as pretty but would get the job done.
Scala’s type system goes far beyond simple generics.
and thats fine in an academic setting, but please don't bring that into the real world unless you have a really good use case.
So then please don't cite Scala as an example of type parameters being not worth it.
it's working fine in the real world enterprise setting too ;)
I've seen nothing but chaos in every org thats adopted it and they all moved to java/kotlin/go, only place I've seen it successful is around Spark. Usage stats back this up