1. Scala Where It Came From Where It is Going Scala Days San Francisco Martin Odersky
2. Scala Where It Came From Scala Days San Francisco Martin Odersky
3. “Scala” is going nowhere “Scala is a gateway drug to Haskell” Recognizing this fact, we should phase out the name “Scala” Idea and Design: Sandro Stucky
5.Where It Came From 1980s Modula-2, Oberon 1990-95 Functional Programming: λ calculus, Haskell, SML 1995-98 Pizza 1998-99 GJ, javac 2000-02 Functional Nets, Funnel 5
6.Motivation for Scala • Grew out of Funnel • Wanted to show that we can do a practical combination of OOP and FP. • What got dropped: • Concurrency was relegated to libraries • No tight connection between language and core calculus (fragments were studied in the νObj paper and others.) • What got added: • Native object and class model, Java interop, XML literals. 6
7.Why <XML>? I wanted Scala to have a hipster syntax. • Everybody uses [..] for arrays, so we use (..) • Everybody uses <..> for types, so we use [..] • But now we needed to find another use of <..>
8.What Makes Scala Scala? Scala is • functional • object-oriented / modular • statically typed • strict • Closest predecessor: OCaml. • Differences: OCaml separates object and module system, Scala unifies them • OCaml uses Hindley/Milner, Scala subtyping + local type inference.
9.1st Invariant: A Scalable Language • Instead of providing lots of features in the language, have the right abstractions so that they can be provided in libraries. • This has worked quite well so far. • It implicitly trusts programmers and library designers to “do the right thing”, or at least the community to sort things out. 9
10.2nd Invariant: It’s about the Types • Scala’s core is its type system. • Most of the advanced types concepts are about flexibility, less so about safety. Trend in Type-systems where we’d like it to move Goals of PL design Safety Scala Flexibility / Ease of Use 10
12.An Emergent Ecosystem ScalaCheck Chisel cats ADAM ScalaTest Play scodec scalaz Specs squeryl Mesos Samza Lift Akka scalatra Spark BlueEyes Kafka Finagle scalding shapeless Slick sbt Scala JVM JS 12
14.Why does Scala.JS work so well? • Because of @srjd, and the great people who contribute. • But also: It plays to the strengths of Scala • Libraries instead of primitives • Flexible type system • Geared for interoperating with a host language.
15.Tool Improvements • Much faster incremental compiler, available in sbt and IDEs • New IDEs • Eclipse IDE 4.0 • IntelliJ 14.0 • Ensime: make the Scala compiler available to help editing
16.With: • New debugger • Faster builds • Integrated ScalaDoc
17.IntelliJ 14.0 Scala plugin With a cool implicit tracker
19.Session Stats So far: 400’000 inscriptions Success rate ~ 10%
20.Where It Is Going?
21.Emergence of a platform • Core libraries • Specifications: • Futures • Reactive Streams • Spores • Common vocabulary à Beginnings of a reactive platform, analogous to Java EE
22.JDK: The Core of the Java Platform Java Source javac Classfiles JDK JIT Native code
23.What Are Classfiles Good For? • Portability across hardware • Portability across OS/s • Interoperability across versions • Place for - optimizations, - analysis, - instrumentation So what is the analogue of the JDK for Scala?
24.Scala piggybacks on the JDK Picture so far: Scala Source scalac Classfiles + Scala Signatures JDK JIT Native code
25.Challenges for Scala • Binary compatibility • scalac has way more transformations to do than javac. • Compilation schemes change • Many implementation techniques are non-local, require co- compilation of library and client. (e.g. trait composition). • Having to pick a platform • Previously: platform is “The JDK.” • In the future: Which JDK? 7, 8, 9, 10? And what about JS?
27.The Core • TASTY: Serialized Typed Abstract Syntax Trees • E.g., here’s a TAST for x + 2 Apply Int Select :: (Int)Int Ident “+” Literal Nil “x” Int Int(2) 2
28.Serialized TASTY File Format A reference format for analysis + transformation of Scala code high-level complete detailed. 28
29.Example: def plus2(x: Int) = x + 2 becomes x + 2 Overall: TASTY trees take up ~25% of classfile size 29