Hacker News new | ask | show | jobs
by pron 4596 days ago
Can you write any program with only case classes and sealed traits? Yes; Haskell does it. Can you write any program with just structural types? Yes, JS does it. Can you write any program with just inheritance types? Yes, Java, C++ and C# do it. Ergo, Scala has three type systems, and it doesn't matter whether you make them appear as one.

> It's all part of the same system; whether you call it an "ADT" or a "class hierarchy" is a design pattern thing more than a rigid systemic property.

Obviously it's part of the same system, which just happens to be a superset of three type systems. A type system is not how its implemented but what it does.

1 comments

You can write any program with a Turing machine. That's a silly definition of a type system. I've never heard this usage anywhere else.