News for hackers. Stuff that matters.
Re:Will Scala ever be enterprise-ready? by tikhonj on Tuesday November 05, 2013 @06:03PM (#6679131)
Classes are types. And in Scala, case classes are just an awkward take on algebraic data types.

Scala doesn't even come close to Haskell. For one, it does not do anything to capture effects in the types. Apart from being markedly less safe, this also makes things like STM impractical. Additionally, implicits may be more powerful than typeclasses, but they're also easy to mess up: you lose canonicity. In Haskell, if you have a Set a, you know it uses the same ordering of a as any other Set a; in Scala, you lose this guarantee. You also don't have any notion of kinds, which makes quite a bit of otherwise-idiomatic code hard to write. Take a look at this post[1] for more examples and details.

[1]: http://www.reddit.com/r/haskell/comments/1pjjy5/odersky_the_...

If you want a simple yet powerful OO system, take a look at OCaml. It does OO much better than any other statically typed language I've used. The funny thing is, of course, that people don't use OCaml's object system--not because it's bad but because by the time you're using OCaml, you've already realized functional programming is the way to go. Most of the reasons I've heard for not using OCaml's object system apply even more to other OO languages!

OCaml's object types are expressive and, unlike Scala, fully inferable. And they don't mess variance up! You also get a dual sub-typing with polymorphic variants--I don't know if Scala can do anything comparable with case classes.

Re:Will Scala ever be enterprise-ready? by runT1ME on Tuesday November 05, 2013 @06:13PM (#6679196)
>You also don't have any notion of kinds, which makes quite a bit of otherwise-idiomatic code hard to write.

I'm not sure that is true. Otherwise this would not be possible: class MyExample[A[_]](a: A)

Re:Will Scala ever be enterprise-ready? by tikhonj on Tuesday November 05, 2013 @06:47PM (#6679390)
Yeah, I think that part was a bit inaccurate. The core problem is more like the fact that higher-kinded code is hard to write. You always end up writing in terms of concrete types--you can talk about A[_], but not about A by itself. This becomes a hassle when working with things like monad transformers.