Live data from Hacker News

Scala 2.11.0-RC1 is now available

scala-lang.org

21–30 of 33 posts

Re: Scala 2.11.0-RC1 is now available

#21

Earlier quoted context omitted.

Compilation is also slowed down by the type system as inference is expensive. Scalac wasn't very aggressive with incremental compilation when I was working with it 8 years ago, it only worked at the file level (not the AST tree level) and the dependency manager didn't handle traits very well. I would hope things are better now.

The biggest hit caused by type inference is not the inference itself, but the downstream recompiling needed. I.e.: - def foo(x: X) = new G2 + def foo(x: X) = new G3 Now all users of `foo` need to be recompiled even if all the downstream classes only want a G (for some G an ancestor of G2 and G3).

Scala's type system computations themselves are expensive, even if you ignore dependency recompilation. Typers is doing lots of heavy lifting if you've ever looked at the code.

Definitely type inference also leads to volatile member signatures, but if the compiler could reach the 1 million lines/second level, then it wouldn't be such a big deal.

Re: Scala 2.11.0-RC1 is now available

#22
post #16

Earlier quoted context omitted.

Before Scala, I have "mastered" until now Ruby, Python, Perl, PHP, Java, C# and Javascript as in I used them for real projects in production for at least 1.5 years each and whenever I learn a new language, I always go in depth. And I also played with half a dozen others. Scala is the language that helps you write better code. In the kinds of projects that I've been working for the last 3 years, requiring parallelism,…

What would you say was the best resource to learn it? I've been curious about Scala for a while, but never really taken the plunge.

I happened to have written a blog post a year ago, that's still valid I think: https://www.bionicspirit.com/blog/2013/05/13/getting-started...

Two takeaways from my article:

1. start reading a book on it

2. subscribe to the scala-user mailing list and ask any questions you may have - some developers there are very advanced, so don't get intimidated by the topics, as beginners' questions are very welcome

I got started with "Scala for the Impatient" and I like its style. You can still get about one third of the book from TypeSafe's website, which is enough to get the ball rolling. It's written for Scala 2.9 so it doesn't have Futures in it, plus you should ignore the stuff about actors in later chapters (actors from the standard library are deprecated, Akka actors have been the norm for some time - and at first you should ignore actors completely, since that's a big topic). But that's OK. In case you'd prefer another book, make sure to not read anything published before 2010 as (IMHO) everything published before 2010 is awful.

Since I wrote that article a couple of newer books happened, that I haven't read, like "Scala in Action" or "Atomic Scala" and thus cannot recommend, but I've heard good things about, so ask others or read reviews, etc...

There's also an advanced book called "Functional Programming in Scala", by Paul Chiusano and Rúnar Bjarnason, I've read about 8 chapters from it and it's a really, really good book on FP design & concepts. However it's a hard read, because while the language is approachable and doesn't assume much Scala knowledge, it's the kind of book that's designed around mind-bending (SICP-style) exercises - it takes me about 1 week to get through a chapter and right now I don't have time for the rest, but with each chapter my knowledge expands :-)

If you like an IDE, IntelliJ IDEA 13 for Scala is everything you'd expect out of an IDE, but as I've said in my blog post, when I'm learning a new language I don't want to bother with learning a new toolset too, so I start with a comfortable plain-text editor and work from there.

When you get stuck, I must emphasize on nr.2 - ask questions on scala-user - beginners are always welcome.

Re: Scala 2.11.0-RC1 is now available

#23
post #3

I've not used Scala since ~March 2013. I sure hope compilation times have improved since then. That was one of the main reasons I stopped using Scala. Scala is one of the easiest languages to read and write once you master it, but the compilation times were frustrating. Excited to try out 2.11 later tonight.

> Scala is one of the easiest languages to read and write once you master it I beg to differ with this. Any languages gets easy to read & write once you master it. After having finished the Scala course and spending considerable time trying to get grips with the language, I was still totally clueless about a majority of the features. Although I really liked how powerful Scala it is even if you grok 30% of its feature…

> Prof Odersky has been quite vocal about the feature bloat and lets hope the future releases are more conservative in that sense.

Languages never get simpler as they age, and Scala is certainly proof of that rule.

If anything, advanced features that make up for good academic papers have priority over fixing bugs and streamlining the libraries.

Paul Phillips, a Typesafe cofounder, recently left the company and went on a tour explaining why he thought Scala was headed in the wrong direction:

http://www.youtube.com/watch?v=4jh94gowim0

Re: Scala 2.11.0-RC1 is now available

#24

Earlier quoted context omitted.

The biggest hit caused by type inference is not the inference itself, but the downstream recompiling needed. I.e.: - def foo(x: X) = new G2 + def foo(x: X) = new G3 Now all users of `foo` need to be recompiled even if all the downstream classes only want a G (for some G an ancestor of G2 and G3).

Scala's type system computations themselves are expensive, even if you ignore dependency recompilation. Typers is doing lots of heavy lifting if you've ever looked at the code. Definitely type inference also leads to volatile member signatures, but if the compiler could reach the 1 million lines/second level, then it wouldn't be such a big deal.

On the other hand, the type system being very static and expressive, the compiler does the kind of work for which in other languages you'd need to run more specialized tools or to write more unit tests. When I'm doing time comparisons, I take into account the whole development workflow, that's why the compiler's speed doesn't bother me as is - I mean, what's slower, compiling code with Scala, or running unit tests in Ruby?

In Scala you get things like this:

     scala> Option(3) match { case Some(nr) => println(nr) }
     :9: warning: match may not be exhaustive.
     It would fail on the following input: None
Or like this:

     val stillAMap: Map[String, String] = Map("hello" -> "world").map { 
       case (key, value) => (key, value + ", Alex") 
     }

     val iterOfInt: Iterable[Int] = Map("hello" -> "world").map { 
       case (key, value) => value.length
     }
And because immutable sequences are covariant, it has no problem in doing this (i.e. in Scala types usually have a natural flow, no need for explicit castings or shoving round pegs in square holes):

     val iterOfAny: Iterable[Any] = iterOfInt
Actually, traits can be used as tags, so say you wanted to model the states of a state-machine, instead of having something like this, which is error prone:

     trait Foo {
       def isOperational: Boolean
       def isDispatched: Boolean
     }

     object Available extends Foo {
       val isOperational = true
       val isDispatched = false
     }

     object RampUp extends Foo {
       val isOperational = true
       val isDispatched = true
     }

     object Fault extends Foo {
       val isOperational = false
       val isDispatched = false       
     }

     // ...
You could do this:

     trait Foo

     trait IsOperational extends Foo
     trait IsNotOperational extends Foo
     trait IsDispatched extends Foo
     trait IsNotDispatched extends Foo

     object Available extends IsOperational with IsNotDispatched
     object RampUp extends IsOperational with IsDispatched
     object Fault extends IsNotOperational with IsNotDispatched
     // ...
And then you could have a pattern matcher definition, for you know, convenience:

     object IsDispatched {
       def unapply(state: IsOperational) = state match {
         case ref: IsDispatched => Some(ref)
         case _ => None
       }
     }
Question: what would be the inferred return type of the above unapply function? That's right, it's Option[IsOperational with IsDispatched].

Basically Scala is the type of static language with which you can enforce correctness of the business logic with types. Yes, the compiler is slow, but it's slow because it does so much and IMHO, that's time well spent.

Now I also like dynamic languages and on the issue of static versus dynamic, I think David Pollak said it better than I could - static type systems work better if the shape of the data you're working with is well defined, whereas dynamic type systems work better if the shape of the data is not well defined. So usually people are on either side of this debate depending on what they are working on ;-)

Re: Scala 2.11.0-RC1 is now available

#25
post #23

Earlier quoted context omitted.

> Scala is one of the easiest languages to read and write once you master it I beg to differ with this. Any languages gets easy to read & write once you master it. After having finished the Scala course and spending considerable time trying to get grips with the language, I was still totally clueless about a majority of the features. Although I really liked how powerful Scala it is even if you grok 30% of its feature…

> Prof Odersky has been quite vocal about the feature bloat and lets hope the future releases are more conservative in that sense. Languages never get simpler as they age, and Scala is certainly proof of that rule. If anything, advanced features that make up for good academic papers have priority over fixing bugs and streamlining the libraries. Paul Phillips, a Typesafe cofounder, recently left the company and went o…

For real?

Paul Philips is an awesome developer, contributed a lot to Scala and he did quit because he thought that Scala was headed in the wrong direction. These are the facts. On the other hand the kind of problems he described are problems that happen in every mainstream language, either due to the pressure of keeping it stable and of backwards compatibility (you know, real world concerns) or because current languages aren't equipped to handle it or because of pragmatic reasons with which he doesn't agree with. And in fact, speaking of "academic papers", some of the problems he cares about can only be fixed for real in languages with dependent types (ever heard of one?).

As for "fixing bugs and streamlining the libraries", if you bothered reading the release notes on Scala 2.11-RC1 before commenting, you would know that this release is exactly about fixing bugs, modularizing the compiler, improved compilation times, streamlining the libraries, eliminating deprecated stuff and so on. By all accounts, it will be an awesome release even though it doesn't add features to the language. It won't solve all of Paul's concerns of course, but there are people that actually care and work on these problems.

But then, whenever that happens, people start complaining that Scala breaks backwards compatibility too often. Apparently you can't please everybody. And btw, the Scala core devs also have plans for breaking source compatibility by implementing a Go-like source-code migrator to get rid of deprecated syntax sometimes in the future.

Most importantly - at the end of that talk, Paul Philips still claims that Scala is his favorite language. But then again, you weren't really interested in what he actually had to say, did you?

Re: Scala 2.11.0-RC1 is now available

#26
post #23

Earlier quoted context omitted.

> Scala is one of the easiest languages to read and write once you master it I beg to differ with this. Any languages gets easy to read & write once you master it. After having finished the Scala course and spending considerable time trying to get grips with the language, I was still totally clueless about a majority of the features. Although I really liked how powerful Scala it is even if you grok 30% of its feature…

> Prof Odersky has been quite vocal about the feature bloat and lets hope the future releases are more conservative in that sense. Languages never get simpler as they age, and Scala is certainly proof of that rule. If anything, advanced features that make up for good academic papers have priority over fixing bugs and streamlining the libraries. Paul Phillips, a Typesafe cofounder, recently left the company and went o…

Oh, laureny, always busy spreading FUD? :-)

Re: Scala 2.11.0-RC1 is now available

#30
post #23

Earlier quoted context omitted.

> Prof Odersky has been quite vocal about the feature bloat and lets hope the future releases are more conservative in that sense. Languages never get simpler as they age, and Scala is certainly proof of that rule. If anything, advanced features that make up for good academic papers have priority over fixing bugs and streamlining the libraries. Paul Phillips, a Typesafe cofounder, recently left the company and went o…

Oh, laureny, always busy spreading FUD? :-)

Lauren Y is a sock puppet account used by Cedric Beust. Primary account activities are promoting his own blog and criticizing Scala, pretending to have worked with it for several years in production before finally deciding that the language is not production ready.

http://www.reddit.com/r/scala/comments/1sdmdq/sockpuppet_acc...

Post reply on HN