Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Well one of the confusions I think early on (or at least professed confusion on Lambda the Ultimate IIRC) is that Scala is mixed paradigm and that adds additional load for learning.

Some feel it should go full FP (what I mean by that is really discourage OOP, side effects, etc...). There is some valid arguments as Rust and Haskell might end up being an easier language to master as you can completely avoid the OOP conversation (polymorphic inheritance seems incredibly simple yet there are whole books written on how to use it.. ie patterns).

I'm curious do you prefer a more OOP imperative approach with some FP or do you prefer the opposite (FP with some slight OOP)?



OOP hate is common these days, but I always has been an OOP enthusiast. I used to write in Smalltalk, I implemented a few metaobject protocols of my own, and I think OOP had deserves its success (unfortunately, C++/Java is not really OOP... However, some principles still apply).

So, when a language appeared to combine the best ideas from FP and OOP, I happily embraced it. And I want it to stay this way.


Scala is a really great OO language, enabling very useful statically typed mixin compositions that you won't find in any other language. Uunfortunately, the vocal side of the community is very much anti OOP, so you don't hear about them much, but it is still there.


There are many excellent non-OO functional languages like Haskell, where functional concepts are mapped to much more elegant syntactic devices, having not much to do with OOP. There, ADTs are not expressed as "case classes", there's no need for implicits and coercions to enable type classes, and one can speak the word "monad" freely and bravely.

However, Scala is not Haskell. Scala's raison d'être is merging FP and OOP, and it excels at it. I'd like to leave it this way.


Sometimes you really need to drop into mutation of state in perf critical paths


There are great tools for that in both Scala and Haskell.

In Scala you can use var, which is easy.

In Haskell you can write your algorithm using ST and then use it as a pure function by means of runST. The type system guarantees that all such state is local to the invocation.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: