4 ms·
Scalas insane generic type system would be an example of them going wrong. The current proposed Go method seems fairly reasonable.
by yahyaheee 7y ago
Scalas insane generic type system would be an example of them going wrong. The current proposed Go method seems fairly reasonable.
- saagarjha 7y agoScala’s type system goes far beyond simple generics.
- yahyaheee 7y agoand thats fine in an academic setting, but please don't bring that into the real world unless you have a really good use case.
- Ericson2314 7y agoSo then please don't cite Scala as an example of type parameters being not worth it.
- yahyaheee 7y agoin academia sure, have fun!
- sideeffffect 7y agoit's working fine in the real world enterprise setting too ;)
- yahyaheee 7y agoI'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
- dxxvi 7y agoI'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.
- yahyaheee 7y agoIt 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.