Scala
A statically typed language that fuses object-oriented and functional programming, compiles to JVM bytecode and calls Java libraries directly.
- What it is
- Programming languages (run on a virtual machine),Functional programming,Object-oriented programming
- Type
- Open source
- Made by
- EPFL and Scala Center
- License
- Apache 2.0
- Facts checked
- 8 October 2026
What it is
Scala treats every value as an object and every function as a value. Classes compose through traits (mixins), and functions can be nested, passed around and used with pattern matching over data. The compiler emits ordinary JVM bytecode, so a Scala program can call any Java library and runs on the same virtual machine as Java.
Scala 3, released in May 2021 after eight years of work on a new compiler (first called Dotty), reworked the language: enum became the standard way to write algebraic data types, given instances replaced implicits for type classes, braces became optional in favor of indentation, and union (A | B) and intersection (A & B) types arrived. A Scala 3 project can still depend on libraries compiled with Scala 2.13.
The JVM isn’t the only target. Scala.js compiles Scala to JavaScript for browsers and Node.js, and Scala Native compiles it ahead of time, through LLVM, to a native executable with a small managed runtime.
Why teams pick it
- Direct interoperability with Java: any JVM library is one import away, and compiled code runs about as fast as Java’s
- A strong type system with algebraic data types, pattern matching, type classes and union types, which catches many errors at compile time
- One language for the JVM, the browser (Scala.js) and native executables (Scala Native)
- Scala 3 minor releases promise not to break binary compatibility, so libraries keep working across 3.x upgrades
Watch out for
- Moving from Scala 2 to Scala 3 is real work for code that uses macros: the macro system was replaced completely
- Minor releases may still break source compatibility in small, rare ways
- Scala Native is still on a 0.5 version line, so the native target is younger than the JVM one
Alternatives
What all run on a virtual machine have in common →How it fits with other technologies
What Scala uses
Scala 3: an enum, pattern matching and a function passed to map · scala
enum Payment:
case Card(last4: String, amount: BigDecimal)
case Cash(amount: BigDecimal)
def describe(p: Payment): String = p match
case Payment.Card(last4, amount) => s"$amount by card ending $last4"
case Payment.Cash(amount) => s"$amount in cash"
@main def demo(): Unit =
val payments = List(Payment.Card("4242", 30), Payment.Cash(12.5))
payments.map(describe).foreach(println)
// 30 by card ending 4242
// 12.5 in cashSee it in a real stack
No architecture uses Scala yet. Drop it into the playground and wire it up yourself.Open playground →Where it came from1995–2021
Martin Odersky had studied under Niklaus Wirth at ETH Zurich and worked on functional languages and type systems. In 1995 he and Philip Wadler wrote Pizza, a functional language that compiled to Java bytecode. That work led to GJ, which became the new javac compiler and Java’s generics. He found extending Java hard, because its many features often clashed with new ones in unforeseen ways.
After joining EPFL in Lausanne in 1999, he wanted to unify functional and object-oriented programming from a clean sheet. A first attempt, Funnel, was minimal and elegant but unpleasant to use, and it showed that a new language needs a large standard library to be adopted. Scala’s design began in 2001 and the first release came in 2003: not an extension of Java, but fully interoperable with it.
In December 2012 work started on a new compiler built on fresh type-theory foundations. After 28,000 commits from more than a hundred contributors, it shipped as Scala 3 in May 2021.
Why it’s built this way
- Interoperate with Java instead of extending it
- Pizza and GJ showed how hard it was to bolt features onto Java. Compiling to the same bytecode let Scala start fresh while still reusing every Java library.
- Every value an object, every function a value
- Odersky saw the two paradigms as two sides of the same coin; classes with mixin composition and first-class functions with pattern matching live in one language.
- Rich syntax over a tiny core
- Funnel encoded almost everything, including classes and pattern matching, in libraries. Non-experts couldn’t write the encodings and experts got bored repeating them, so Scala made these features part of the language.
Timeline
- 1995
Odersky and Wadler’s Pizza compiles a functional language to Java bytecode
- 1999
Odersky joins EPFL and builds Funnel
- 2001
Design of Scala begins
- 2003
First Scala release
- 2012
First commit of the compiler that becomes Scala 3, on December 6
- 2021
Scala 3 released in May
Sources7 · facts checked 8 October 2026
- Martin Odersky: A brief history of Scala (every value an object, every function a value, Java interoperability)
- Scala docs: New in Scala 3 (enums, given instances, optional braces, union types, macros)
- Scala blog: Scala 3 is here (release guarantees, macros changed completely)
- Scala 3 migration guide: classpath compatibility with Scala 2.13
- Scala.js: compiles Scala to JavaScript for browsers and Node.js
- Scala Native documentation (ahead-of-time compiler via LLVM, stable 0.5.11)
- Scala license: Apache License 2.0