Making scala easier and more popular, with compiler level switches

(NB: I do Scala training, among other things, professionally.)

Some thoughts…

Note that this idea has been around for a long time – I and others were pushing for it something like 8-9 years ago, and Martin responded with what have become informally known as “the Odersky levels”. They’re worth reading, since they are very much to your point.

That definition is pretty old and partly obsolete; I’ve been toying with coming up with a strawman new definition for us to debate, but haven’t had time yet.

Little of it is compiler-enforced yet. I suspect that it would be somewhat challenging and hacky to build in the old compiler, but it seems like it might be more practical in the new TASTy-based world. Or possibly through Scalafix? It feels like you could probably build at least some of this simply as Scalafix rules. That’s a bit post-facto, but if you plug it into your sbt build, it seems like it would be almost like being compiler-enforced.

Keep in mind that there is no single sensible definition of “introductory Scala”. We thought that made sense in the old days, when we were strictly focused on people coming in from Java. But I’ve found that folks coming from Java often have very different hurdles from those coming in from JavaScript or Python – they actually call for different “introductory” subsets.

Also, many of the really advanced features are already slightly “hidden”, in that they are only enabled via explicit language imports. (Whether that is helpful or not is a topic of some debate.)

All that said, it’s worth noting that, yes, the amount folks can grasp in the first hour is pretty limited. But I’ve found that, with three days of training, we can usually teach a large swathe of the main concepts to most experienced programmers. So IMO the issue is real, but is often overestimated – it can be a barrier to casual adoption, but less so for companies that want to train people up.

And carrying this too far is counter-productive, IMO: teaching people pure Java-in-Scala (which is what you tend to get if you remove everything like case classes and pattern matching) winds up inculcating bad habits that can be really painful to unlearn later. Idiomatic Scala is different, and I’ve had much more success teaching these basic tools and why they are cool and helpful, as quickly as possible, rather than coddling folks too much and pretending it doesn’t exist. Most programmers, in my experience, are happy to learn a new concept if you can show, really concretely, why it will make their life easier. So in general, my first hour is similar to what you’re describing, but by the end of the first day it’s getting rather different, and folks are starting to have more fun…