This is false, you were misinformed.
>Sure. C++, Java, C#.
C++ Has a good type system, IMO. The other two are broken. Literally, you can write broken code. Scala has a long list of warts, I just don't think you're listing any of them.
>Well, Scala doesn't give you safety any more than C++ or Java, and as for design, it can't even pick one type system; a cornerstone of great design is that you have to make hard choices.
This is just FUD. Are you telling me Java/C#'s type systems enforce more safety than Scala? Because they don't. They don't get variance right. Do you know what variance is? You ignored that part of my comment.
If I'm wrong, I apologize. I am not familiar with any concurrent data structures in a pure functional language, but I'd love to learn of any. I have not encountered a data structure in a functional language that supports more than one concurrent writer (and I don't mean parallel construction of an immutable DS - that's trivial – but concurrent mutation, like in a concurrent B-Tree, concurrent skip-list, or concurrent hash map).
http://www.scribd.com/doc/28336206/Multicore-programming-in-...
As of C++ templates being extremely powerful - I agree. But this is a similar kind of "powerfulness" as C macros are, only little safer. Technically they are still just a fancy macrogenerator working at the AST level instead of lexer level, knowing nothing about the types (you even have to tell it which symbols are the types, because it cannot reason it out from syntax). IMHO it is years behind true generic typesystems like in Haskell, OCaml or Scala and calling it a "type system" is an exaggeration.
This can't be stated enough, and it's a huge problem in Java and C#. Unfortunately, most programmers don't care and simply continue to write broken code.
I don't see how the sugar makes them a fundamentally different kind of Type system?
And Structural Typing is just Reflection I thought. It's still compile time (which is kinda the point). Which again doesn't feel like an alternative Type system.
But I'm not at all versed in Type theory so maybe I'm just mischaracterizing what a Type is...
They're not sugar. Their crucial feature is that they can't form an inheritance hierarchy, which doesn't work well in an algebraic type system.
> And Structural Typing is just Reflection I thought... Which again doesn't feel like an alternative Type system.
The point is that you can write (and obviously people have) a big, complex piece of software just with inheritance-based types, or just with algebraic types, or just with duck types. They all serve quite nicely. It is completely unnecessary to put them all in a single language (other than to advance compiler technology), and worse than that: putting them all together takes away their respective advantages and causes a lot of confusion.
These things (types) do have uses, but not as competing systems in Scala, but Features. I want to write c#'s using() statement, I'm not especially worried about performance, I can't go and add IDisposable to everything because I want to use it with other people's code and I don't feel like writing a Type Class every time I need to work with a new type. Structural typing is a really convenient feature for that.
Case classes are just Scala's version of a data-object. If you didn't have them you'd just be writing your own version, poorly, and forgetting about hash code and equals and all the other stuff until it bit you.
I really don't see a rationale here for removing these other than you find it offensive. I use Scala because of these things.
Because you can do casts, and it's not pure. It doesn't even enforce immutability. You know what? Forget about enforcing – it doesn't even make mutability or casts hard. Look, Haskell is certainly not my cup of tea. Personally, I don't think the effort of thinking about my program twice (once in terms of logic and once in terms of types) is worth it in most circumstances, and pure functional languages don't support concurrent data structures which is what I deal with the most. But I do recognize Haskell's elegance, and if the elaborate type system is worth it, it's only because it can enforce many guarantees. I mean, the whole point of Haskell is that it supposedly makes safer programs. So you pay for the elaborate types (though some consider it a plus), but you gain safety. With Scala you just pay.
> Uhm, can you explain to me an example of a simple OO type system that is 'just powerful enough'?
Sure. C++, Java, C#. Almost all of the world's software is written in C++ or Java. The question is not which language has "the best type system" (and even if it were, Scala can't make up its mind because it's got three of them). A type system is not an end but a means. Practically everyone who deals with type systems agrees that they come at a cost (and Martin Odersky himself admitted as much). But the cost hopefully buys you something. It arguably buys you better design, and it definitely buys you safety. Well, Scala doesn't give you safety any more than C++ or Java, and as for design, it can't even pick one type system; a cornerstone of great design is that you have to make hard choices.