Hacker News new | ask | show | jobs
by MiroF 2367 days ago
This is all marketing.

I've never found a more sophisticated type system anything but helpful. It's easy for beginners to start, but when you don't have a good type system and you have a complicated project things quickly become a nightmare.

1 comments

eh, there is still a cost to it, don't get me wrong I generally think generics are worth the cost if done right, but they can also go really wrong
When?
Scalas insane generic type system would be an example of them going wrong. The current proposed Go method seems fairly reasonable.
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 ;)