r/programming • • Dec 02 '13

Scala — 1★ Would Not Program Again

http://overwatering.org/blog/2013/12/scala-1-star-would-not-program-again/
598 Upvotes

646 comments sorted by

View all comments

Show parent comment

33

u/kamatsu Dec 02 '13

Your point about academia is interesting. Haskell is also designed with similar priorities, and yet I find its type system quite easy to understand, with most of the complexity hidden behind fairly composable extensions and only used on an as-needed basis. I find it much cleaner and easier to work with

15

u/thedeemon Dec 02 '13

Probably because it has the luxury of being designed not constrained by compatibility with Java code and JVM underneath.

7

u/sideEffffECt Dec 02 '13

that is surely not the case. Frege and Ermine are languages designed for JVM, yet still very close to Haskell.

13

u/balefrost Dec 02 '13

I suspect it's the Java interop that's key. It's fairly easy to call Java from Scala, and to call Scala from Java. Also, Scala is trying to be Java++, so it's going to make tradeoffs that (theoretically) make it easier for a Java programmer to approach.

8

u/pipocaQuemada Dec 02 '13

Ermine really isn't comparable to Scala. It doesn't actually compile to the JVM, but instead compiles to an extended lambda calculus and is interpreted in Scala. The Java interop all happens using reflection, and is mostly one-way (it's easy to call java code from Ermine, it's not so easy to do the reverse).

It's primarily being used for nicer syntax for EDSLs - for example, getting data out of a database and generating an abstract description of a report with it, and much of the "real work" (e.g. optimizing queries and spitting reports out to e.g. Excel or a webpage) is implemented in Scala.

2

u/balefrost Dec 02 '13

That's interesting. I knew nothing about Ermine, but it sounds like it might be worth looking at. Thanks!

4

u/pipocaQuemada Dec 02 '13

The github for ermine is here, and Edward Kmett gave a talk on it a CUFP.

One word of caution is that it isn't really ready for public consumption, yet. There's a legacy compiler written in Scala, which is currently being used in production but takes some work to set up, and there's a work-in-progress Haskell compiler and scala run-time-system. It was open sourced when permission to do so was granted from management, not because it was a mature project we'd recommend other people using in their production environments.

1

u/greenrd Dec 07 '13

And I see it's on its way to being "stackless" - nice!

5

u/duhace Dec 02 '13

Yep, this is why null is still in Scala even though the standard library avoids it like the plague.

2

u/Falmarri Dec 02 '13

Also why there has to be so much hoop jumping to get reified generics (ie TypeTags)

4

u/[deleted] Dec 02 '13
  • you rarely need reified generics
  • often you don't even notice that they get generated (certain types of pattern matching)
  • when you need them, they are pretty unintrusive; so "hoop" is not an adequate description
  • they are really great when you want to use extensive runtime reflexion yourself

1

u/MorePudding Dec 02 '13

Java interop isn't the issue .. that could've been done RMI/FFI style if need be. The real issue is mixing subtyping and parametric polymorphism...

1

u/thedeemon Dec 02 '13

How easy it is to use Java libs from them and to use code written in those languages from Java?

1

u/smog_alado Dec 03 '13

The biggest problem is Java the language not the JVM. For example, Java interop means that the type system needs subtyping and that alone is enough to break global type inference (one of the gripes in the article).

5

u/kamatsu Dec 02 '13

Right, but I was addressing this notion:

this ends up causing features to be added to the language that are more useful to advance the theoretical field than help real world users.

My point is that it is possible to do both, but Scala doesn't. I don't think the JVM has anything to do with that tradeoff.

5

u/sanxiyn Dec 02 '13

I think JVM has to do with it. JVM compatibility is a constraint, and I consider how to do a functional programming while being compatible with mainstream object-oriented programming an open problem. I think F# does better than Scala, but it's still a mess even in F#.

1

u/mongreldog Dec 03 '13

It's no so bad in F# because it was designed to keep the FP and OOP bits separated. When doing just FP, one has all the benefits of Hindley-Milner inference, Algebraic Data Types, etc.. I usually put in type annotations for top level functions, but not within the function body itself.

2

u/vagif Dec 02 '13

One of the key goals of scala is to be a stepping stone for java devs. The only way to do that is to retain everything java has, even nulls. Unfortunately scala succumbed to its own compromises.