SlideShare a Scribd company logo
1 of 47
Download to read offline
The Evolution of Scala
Martin Odersky
Scala Italy 2015
“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
Now Seriously...
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
4
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.
5
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 <..>
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.
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.
8
•  Scala’s core is its type system.
•  Most of the advanced types concepts are about flexibility, less so
about safety.
2nd Invariant: It’s about the Types
9
Flexibility / Ease of Use
Safety
Scala
Trend in Type-systems
Goals of PL design
where we’d like it to move
The Present
11
An Emergent Ecosystem
Scala
Akka
Play
Slick
Spark
JVM
Kafka
Mesos
Chisel
scalaz
cats
scalding
ScalaCheck
scodec
Specs
squeryl
Samza
Finagle
ScalaTest
shapeless
sbt
Lift
BlueEyesscalatra
JS
ADAM
New Environment: Scala.JS
Feb 5, 2015:
Scala.JS 0.6 released
No longer experimental!
Fast
Great interop with Javascript libraries
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.
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
With:
•  New debugger
•  Faster builds
•  Integrated ScalaDoc
IntelliJ 14.0 Scala plugin
With a cool
implicit tracker
Online Courses
Session Stats
So far:
400’000
inscriptions
Success rate 

~ 10%
Where It Is Going?
Emergence of a platform
•  Core libraries
•  Specifications:
•  Futures
•  Reactive Streams
•  Spores
•  Common vocabulary
à Beginnings of a reactive platform, analogous to Java EE
Java Source
Classfiles
Native code
JDK: The Core of the Java Platform
javac
JDK JIT
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?
Picture so far:
Scala Source
Classfiles + Scala Signatures
Native code
Scala piggybacks on the JDK
scalac
JDK JIT
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?
Scala Source
TASTY
Minimized JavaScript Classfiles
Native code Native Code
A Scala-Specific Platform
packaging
tool / linker
JDK JIT
scalac
JS JIT
•  TASTY: Serialized Typed Abstract Syntax Trees
•  E.g., here’s a TAST for x	
  +	
  2	
  	
  
The Core
Apply	
  
Select	
  
Ident	
   “+”	
  
“x”	
  
::	
  
Literal	
   Nil	
  
2
Int	
  
(Int)Int	
  
Int(2)	
  
Int	
  
Serialized TASTY File Format
27
A reference format for
analysis + transformation 

of Scala code
high-level
complete
detailed.
def	
  plus2(x:	
  Int)	
  =	
  x	
  +	
  2 becomes
Overall: TASTY trees take up ~25% of classfile size
Example:
28
x	
  +	
  2	
  
What We Can Do With It
Applications:
•  instrumentation
•  optimization
•  code analysis
•  refactoring
Publish once, run everywhere.
Automated remapping to solve binary compatibility issues.
Language and Foundations
Connect the Dots
DOT: A calculus for
Papers in FOOL ‘12, OOPSLA ’14.

Work on developing a fully expressive machine-verified version 

is still onoping.
dotc: A compiler for a cleaned up version of Scala.
lampepfl/dotty on Github
31
DOT (in FOOL ‘12)
dotc: Cleaning up Scala
XML Literals à String interpolation
xml”””<A>this	
  slide</A>”””	
   	
  
Procedure Syntax à _
Early initializers à Trait parameters
trait	
  2D(x:	
  Double,	
  y:	
  Double)	
  
More Simplifications
Existential types	
  
List[T]	
  forSome	
  {	
  type	
  T},	
  List[_]	
  
Higher-kinded types
List	
  
à Type with uninstantiated type members
List	
  
expands to
Type Parameters as Syntactic Sugar
class	
  List[T]	
  {	
  ...	
  }	
  
class	
  List	
  {	
  	
  
	
  	
  type	
  List$T	
  
	
  	
  private	
  type	
  T	
  =	
  List$T	
  	
  
}	
  
expands to
General Higher-Kinded Types 

through Typed Lambdas
type	
  Two[T]	
  =	
  (T,	
  T)	
  
type	
  Two	
  =	
  Lambda	
  {	
  
	
  	
  type	
  hk$Arg	
  
	
  	
  type	
  Apply	
  =	
  (hk$arg,	
  hk$arg)	
  
}	
  
expands to
General Higher-Kinded Types 

through Typed Lambdas
Two[String]	
  
Two	
  {	
  	
  
	
  	
  type	
  hk$Arg	
  =	
  String	
  	
  
}	
  #	
  Apply	
  
New Concepts
Type unions (T&U) and intersections (T|U)	
  
•  replace compound types (T with U)
•  Eliminate potential of blow-up in least upper bound / greatest lower
bound operations
•  Make the type system cleaner and more regular (e.g. intersection, union
are commutative).
•  But pose new challenges for compilation. E.g.
class	
  A	
  {	
  def	
  x	
  =	
  1	
  }	
  
class	
  B	
  {	
  def	
  x	
  =	
  2	
  }	
  
	
  	
  	
  val	
  ab:	
  A	
  |	
  B	
  =	
  ???	
  
	
  	
  	
  ab.x 	
   	
   	
  // which x gets called?
Status
Compiler close to completion
Should have an alpha release by ScalaDays Amsterdam
Plan to use TASTY for 

merging dotc and scalac.
Plans for Exploration
1. Implicits that compose
We already have implicit lambdas
implicit	
  x	
  =>	
  t 	
   	
   	
  implicit	
  transaction	
  =>	
  body	
  
What about if we also allow implicit function types?
implicit	
  Transaction	
  =>	
  Result	
  
Then we can abstract over implicits:
type	
  Transactional[R]	
  =	
  implicit	
  Transaction	
  =>	
  R	
  
Types like these compose, e.g.
type	
  TransactionalIO[R]	
  =	
  Transactional[IO[R]]	
  
expands to
New Rule: 



If the expected type of an expression E is an implicit
function, E is automatically expanded to an implicit closure.
def	
  f:	
  Transactional[R]	
  =	
  body	
  
def	
  f:	
  Transactional[R]	
  =	
  	
  
	
  	
  implicit	
  _:	
  Transaction[R]	
  =>	
  body	
  
2. Better Treatment of effects
So far, purity in Scala is by convention, not by coercion.
In that sense, Scala is not a pure functional language.
We’d like to explore “scalarly” ways to express effects of functions.
Effects can be quite varied, e.g.

- Mutation

- IO

- Exceptions

- Null-dereferencing, ...

Two essential properties:
- they are additive,

- they propagate along the call-graph.
`
“Though Shalt Use Monads for Effects”
Monads are cool
But for Scala I hope we find something even better.
•  Monads don’t commute.
•  Require monad transformers for composition.
•  I tried to wrap my head around it, but then it exploded.
use this
Idea: Use implicits to model effects as
capabilities



def	
  f:	
  R	
  throws	
  Exc	
  =	
  ...	
  
def	
  f(implicit	
  t:	
  CanThrow[Exc]):	
  R	
  =	
  ...	
  
instead of this
type	
  throws[R,	
  Exc]	
  =	
  	
  
	
  	
  implicit	
  CanThrow[Exc]	
  =>	
  R	
  
or add this
to get back to this!
In Summary
Scala
-  established functional programming in the mainstream,
-  showed that a fusion with object-oriented programming is possible
and useful,
-  promoted the adoption of strong static typing,
-  has lots of enthusiastic users, conference attendees included.
Despite it being 10 years out it has few close competitors.
46
Our Aims
•  Make the platform more powerful
•  Make the language simpler
•  Work on foundations to get to the essence of Scala.
Let’s continue to work together to achieve this.
Thank You!

More Related Content

What's hot

Introduction to Scala
Introduction to ScalaIntroduction to Scala
Introduction to ScalaRahul Jain
 
What To Leave Implicit
What To Leave ImplicitWhat To Leave Implicit
What To Leave ImplicitMartin Odersky
 
Scala Talk at FOSDEM 2009
Scala Talk at FOSDEM 2009Scala Talk at FOSDEM 2009
Scala Talk at FOSDEM 2009Martin Odersky
 
Scala : language of the future
Scala : language of the futureScala : language of the future
Scala : language of the futureAnsviaLab
 
Introduction to Scala
Introduction to ScalaIntroduction to Scala
Introduction to ScalaSaleem Ansari
 
flatMap Oslo presentation slides
flatMap Oslo presentation slidesflatMap Oslo presentation slides
flatMap Oslo presentation slidesMartin Odersky
 
A Brief Intro to Scala
A Brief Intro to ScalaA Brief Intro to Scala
A Brief Intro to ScalaTim Underwood
 
The Evolution of Scala / Scala進化論
The Evolution of Scala / Scala進化論The Evolution of Scala / Scala進化論
The Evolution of Scala / Scala進化論scalaconfjp
 
Scala, Akka, and Play: An Introduction on Heroku
Scala, Akka, and Play: An Introduction on HerokuScala, Akka, and Play: An Introduction on Heroku
Scala, Akka, and Play: An Introduction on HerokuHavoc Pennington
 
Introduction to Functional Programming with Scala
Introduction to Functional Programming with ScalaIntroduction to Functional Programming with Scala
Introduction to Functional Programming with Scalapramode_ce
 
A Scala tutorial
A Scala tutorialA Scala tutorial
A Scala tutorialDima Statz
 
What To Leave Implicit
What To Leave ImplicitWhat To Leave Implicit
What To Leave ImplicitMartin Odersky
 
Introduction to Scala | Big Data Hadoop Spark Tutorial | CloudxLab
Introduction to Scala | Big Data Hadoop Spark Tutorial | CloudxLabIntroduction to Scala | Big Data Hadoop Spark Tutorial | CloudxLab
Introduction to Scala | Big Data Hadoop Spark Tutorial | CloudxLabCloudxLab
 
Why Scala for Web 2.0?
Why Scala for Web 2.0?Why Scala for Web 2.0?
Why Scala for Web 2.0?Alex Payne
 
Weaving Dataflows with Silk - ScalaMatsuri 2014, Tokyo
Weaving Dataflows with Silk - ScalaMatsuri 2014, TokyoWeaving Dataflows with Silk - ScalaMatsuri 2014, Tokyo
Weaving Dataflows with Silk - ScalaMatsuri 2014, TokyoTaro L. Saito
 
Why Scala Is Taking Over the Big Data World
Why Scala Is Taking Over the Big Data WorldWhy Scala Is Taking Over the Big Data World
Why Scala Is Taking Over the Big Data WorldDean Wampler
 
Haskell vs. F# vs. Scala
Haskell vs. F# vs. ScalaHaskell vs. F# vs. Scala
Haskell vs. F# vs. Scalapt114
 

What's hot (19)

Introduction to Scala
Introduction to ScalaIntroduction to Scala
Introduction to Scala
 
What To Leave Implicit
What To Leave ImplicitWhat To Leave Implicit
What To Leave Implicit
 
Scala Talk at FOSDEM 2009
Scala Talk at FOSDEM 2009Scala Talk at FOSDEM 2009
Scala Talk at FOSDEM 2009
 
Scala : language of the future
Scala : language of the futureScala : language of the future
Scala : language of the future
 
Introduction to Scala
Introduction to ScalaIntroduction to Scala
Introduction to Scala
 
flatMap Oslo presentation slides
flatMap Oslo presentation slidesflatMap Oslo presentation slides
flatMap Oslo presentation slides
 
Preparing for Scala 3
Preparing for Scala 3Preparing for Scala 3
Preparing for Scala 3
 
A Brief Intro to Scala
A Brief Intro to ScalaA Brief Intro to Scala
A Brief Intro to Scala
 
The Evolution of Scala / Scala進化論
The Evolution of Scala / Scala進化論The Evolution of Scala / Scala進化論
The Evolution of Scala / Scala進化論
 
Scala, Akka, and Play: An Introduction on Heroku
Scala, Akka, and Play: An Introduction on HerokuScala, Akka, and Play: An Introduction on Heroku
Scala, Akka, and Play: An Introduction on Heroku
 
Introduction to Functional Programming with Scala
Introduction to Functional Programming with ScalaIntroduction to Functional Programming with Scala
Introduction to Functional Programming with Scala
 
A Scala tutorial
A Scala tutorialA Scala tutorial
A Scala tutorial
 
Simplicitly
SimplicitlySimplicitly
Simplicitly
 
What To Leave Implicit
What To Leave ImplicitWhat To Leave Implicit
What To Leave Implicit
 
Introduction to Scala | Big Data Hadoop Spark Tutorial | CloudxLab
Introduction to Scala | Big Data Hadoop Spark Tutorial | CloudxLabIntroduction to Scala | Big Data Hadoop Spark Tutorial | CloudxLab
Introduction to Scala | Big Data Hadoop Spark Tutorial | CloudxLab
 
Why Scala for Web 2.0?
Why Scala for Web 2.0?Why Scala for Web 2.0?
Why Scala for Web 2.0?
 
Weaving Dataflows with Silk - ScalaMatsuri 2014, Tokyo
Weaving Dataflows with Silk - ScalaMatsuri 2014, TokyoWeaving Dataflows with Silk - ScalaMatsuri 2014, Tokyo
Weaving Dataflows with Silk - ScalaMatsuri 2014, Tokyo
 
Why Scala Is Taking Over the Big Data World
Why Scala Is Taking Over the Big Data WorldWhy Scala Is Taking Over the Big Data World
Why Scala Is Taking Over the Big Data World
 
Haskell vs. F# vs. Scala
Haskell vs. F# vs. ScalaHaskell vs. F# vs. Scala
Haskell vs. F# vs. Scala
 

Similar to Martin Odersky - Evolution of Scala

Spark - The Ultimate Scala Collections by Martin Odersky
Spark - The Ultimate Scala Collections by Martin OderskySpark - The Ultimate Scala Collections by Martin Odersky
Spark - The Ultimate Scala Collections by Martin OderskySpark Summit
 
scalaliftoff2009.pdf
scalaliftoff2009.pdfscalaliftoff2009.pdf
scalaliftoff2009.pdfHiroshi Ono
 
scalaliftoff2009.pdf
scalaliftoff2009.pdfscalaliftoff2009.pdf
scalaliftoff2009.pdfHiroshi Ono
 
scalaliftoff2009.pdf
scalaliftoff2009.pdfscalaliftoff2009.pdf
scalaliftoff2009.pdfHiroshi Ono
 
scalaliftoff2009.pdf
scalaliftoff2009.pdfscalaliftoff2009.pdf
scalaliftoff2009.pdfHiroshi Ono
 
Scala final ppt vinay
Scala final ppt vinayScala final ppt vinay
Scala final ppt vinayViplav Jain
 
Martin Odersky: What's next for Scala
Martin Odersky: What's next for ScalaMartin Odersky: What's next for Scala
Martin Odersky: What's next for ScalaMarakana Inc.
 
The Why and How of Scala at Twitter
The Why and How of Scala at TwitterThe Why and How of Scala at Twitter
The Why and How of Scala at TwitterAlex Payne
 
An Introduction to Scala - Blending OO and Functional Paradigms
An Introduction to Scala - Blending OO and Functional ParadigmsAn Introduction to Scala - Blending OO and Functional Paradigms
An Introduction to Scala - Blending OO and Functional ParadigmsMiles Sabin
 
Scala for n00bs by a n00b.
Scala for n00bs by a n00b.Scala for n00bs by a n00b.
Scala for n00bs by a n00b.brandongulla
 
Concurrency Constructs Overview
Concurrency Constructs OverviewConcurrency Constructs Overview
Concurrency Constructs Overviewstasimus
 
A Tour Of Scala
A Tour Of ScalaA Tour Of Scala
A Tour Of Scalafanf42
 
Scala, Play 2.0 & Cloud Foundry
Scala, Play 2.0 & Cloud FoundryScala, Play 2.0 & Cloud Foundry
Scala, Play 2.0 & Cloud FoundryPray Desai
 
A full Machine learning pipeline in Scikit-learn vs in scala-Spark: pros and ...
A full Machine learning pipeline in Scikit-learn vs in scala-Spark: pros and ...A full Machine learning pipeline in Scikit-learn vs in scala-Spark: pros and ...
A full Machine learning pipeline in Scikit-learn vs in scala-Spark: pros and ...Jose Quesada (hiring)
 
Principled io in_scala_2019_distribution
Principled io in_scala_2019_distributionPrincipled io in_scala_2019_distribution
Principled io in_scala_2019_distributionRaymond Tay
 
ScalaDays 2013 Keynote Speech by Martin Odersky
ScalaDays 2013 Keynote Speech by Martin OderskyScalaDays 2013 Keynote Speech by Martin Odersky
ScalaDays 2013 Keynote Speech by Martin OderskyTypesafe
 
About Functional Programming
About Functional ProgrammingAbout Functional Programming
About Functional ProgrammingAapo Kyrölä
 
Introduction to scala for a c programmer
Introduction to scala for a c programmerIntroduction to scala for a c programmer
Introduction to scala for a c programmerGirish Kumar A L
 

Similar to Martin Odersky - Evolution of Scala (20)

Spark - The Ultimate Scala Collections by Martin Odersky
Spark - The Ultimate Scala Collections by Martin OderskySpark - The Ultimate Scala Collections by Martin Odersky
Spark - The Ultimate Scala Collections by Martin Odersky
 
scalaliftoff2009.pdf
scalaliftoff2009.pdfscalaliftoff2009.pdf
scalaliftoff2009.pdf
 
scalaliftoff2009.pdf
scalaliftoff2009.pdfscalaliftoff2009.pdf
scalaliftoff2009.pdf
 
scalaliftoff2009.pdf
scalaliftoff2009.pdfscalaliftoff2009.pdf
scalaliftoff2009.pdf
 
scalaliftoff2009.pdf
scalaliftoff2009.pdfscalaliftoff2009.pdf
scalaliftoff2009.pdf
 
Scala final ppt vinay
Scala final ppt vinayScala final ppt vinay
Scala final ppt vinay
 
Martin Odersky: What's next for Scala
Martin Odersky: What's next for ScalaMartin Odersky: What's next for Scala
Martin Odersky: What's next for Scala
 
Flatmap
FlatmapFlatmap
Flatmap
 
The Why and How of Scala at Twitter
The Why and How of Scala at TwitterThe Why and How of Scala at Twitter
The Why and How of Scala at Twitter
 
An Introduction to Scala - Blending OO and Functional Paradigms
An Introduction to Scala - Blending OO and Functional ParadigmsAn Introduction to Scala - Blending OO and Functional Paradigms
An Introduction to Scala - Blending OO and Functional Paradigms
 
Scala for n00bs by a n00b.
Scala for n00bs by a n00b.Scala for n00bs by a n00b.
Scala for n00bs by a n00b.
 
Concurrency Constructs Overview
Concurrency Constructs OverviewConcurrency Constructs Overview
Concurrency Constructs Overview
 
Scala-Ls1
Scala-Ls1Scala-Ls1
Scala-Ls1
 
A Tour Of Scala
A Tour Of ScalaA Tour Of Scala
A Tour Of Scala
 
Scala, Play 2.0 & Cloud Foundry
Scala, Play 2.0 & Cloud FoundryScala, Play 2.0 & Cloud Foundry
Scala, Play 2.0 & Cloud Foundry
 
A full Machine learning pipeline in Scikit-learn vs in scala-Spark: pros and ...
A full Machine learning pipeline in Scikit-learn vs in scala-Spark: pros and ...A full Machine learning pipeline in Scikit-learn vs in scala-Spark: pros and ...
A full Machine learning pipeline in Scikit-learn vs in scala-Spark: pros and ...
 
Principled io in_scala_2019_distribution
Principled io in_scala_2019_distributionPrincipled io in_scala_2019_distribution
Principled io in_scala_2019_distribution
 
ScalaDays 2013 Keynote Speech by Martin Odersky
ScalaDays 2013 Keynote Speech by Martin OderskyScalaDays 2013 Keynote Speech by Martin Odersky
ScalaDays 2013 Keynote Speech by Martin Odersky
 
About Functional Programming
About Functional ProgrammingAbout Functional Programming
About Functional Programming
 
Introduction to scala for a c programmer
Introduction to scala for a c programmerIntroduction to scala for a c programmer
Introduction to scala for a c programmer
 

More from Scala Italy

Alessandro Abbruzzetti - Kernal64
Alessandro Abbruzzetti - Kernal64Alessandro Abbruzzetti - Kernal64
Alessandro Abbruzzetti - Kernal64Scala Italy
 
Alberto Paro - Hands on Scala.js
Alberto Paro - Hands on Scala.jsAlberto Paro - Hands on Scala.js
Alberto Paro - Hands on Scala.jsScala Italy
 
Andrea Lattuada, Gabriele Petronella - Building startups on Scala
Andrea Lattuada, Gabriele Petronella - Building startups on ScalaAndrea Lattuada, Gabriele Petronella - Building startups on Scala
Andrea Lattuada, Gabriele Petronella - Building startups on ScalaScala Italy
 
Stefano Rocco, Roberto Bentivoglio - Scala in increasingly demanding environm...
Stefano Rocco, Roberto Bentivoglio - Scala in increasingly demanding environm...Stefano Rocco, Roberto Bentivoglio - Scala in increasingly demanding environm...
Stefano Rocco, Roberto Bentivoglio - Scala in increasingly demanding environm...Scala Italy
 
Federico Feroldi - Scala microservices
Federico Feroldi - Scala microservicesFederico Feroldi - Scala microservices
Federico Feroldi - Scala microservicesScala Italy
 
Daniela Sfregola - Intro to Akka
Daniela Sfregola - Intro to AkkaDaniela Sfregola - Intro to Akka
Daniela Sfregola - Intro to AkkaScala Italy
 
Mirco Dotta - Akka Streams
Mirco Dotta - Akka StreamsMirco Dotta - Akka Streams
Mirco Dotta - Akka StreamsScala Italy
 
Phil Calçado - Your microservice as a function
Phil Calçado - Your microservice as a functionPhil Calçado - Your microservice as a function
Phil Calçado - Your microservice as a functionScala Italy
 
Scalatra - Massimiliano Dessì (Energeya)
Scalatra - Massimiliano Dessì (Energeya)Scalatra - Massimiliano Dessì (Energeya)
Scalatra - Massimiliano Dessì (Energeya)Scala Italy
 
Scala: the language of languages - Mario Fusco (Red Hat)
Scala: the language of languages - Mario Fusco (Red Hat)Scala: the language of languages - Mario Fusco (Red Hat)
Scala: the language of languages - Mario Fusco (Red Hat)Scala Italy
 
Reflection in Scala Whats, Whys and Hows - Walter Cazzola (Dipartimento di In...
Reflection in Scala Whats, Whys and Hows - Walter Cazzola (Dipartimento di In...Reflection in Scala Whats, Whys and Hows - Walter Cazzola (Dipartimento di In...
Reflection in Scala Whats, Whys and Hows - Walter Cazzola (Dipartimento di In...Scala Italy
 
Simplifying development-short - Mirco Dotta (Typesafe)
Simplifying development-short - Mirco Dotta (Typesafe)Simplifying development-short - Mirco Dotta (Typesafe)
Simplifying development-short - Mirco Dotta (Typesafe)Scala Italy
 
Scala in pratica - Stefano Rocco (MoneyFarm)
Scala in pratica - Stefano Rocco (MoneyFarm)Scala in pratica - Stefano Rocco (MoneyFarm)
Scala in pratica - Stefano Rocco (MoneyFarm)Scala Italy
 

More from Scala Italy (13)

Alessandro Abbruzzetti - Kernal64
Alessandro Abbruzzetti - Kernal64Alessandro Abbruzzetti - Kernal64
Alessandro Abbruzzetti - Kernal64
 
Alberto Paro - Hands on Scala.js
Alberto Paro - Hands on Scala.jsAlberto Paro - Hands on Scala.js
Alberto Paro - Hands on Scala.js
 
Andrea Lattuada, Gabriele Petronella - Building startups on Scala
Andrea Lattuada, Gabriele Petronella - Building startups on ScalaAndrea Lattuada, Gabriele Petronella - Building startups on Scala
Andrea Lattuada, Gabriele Petronella - Building startups on Scala
 
Stefano Rocco, Roberto Bentivoglio - Scala in increasingly demanding environm...
Stefano Rocco, Roberto Bentivoglio - Scala in increasingly demanding environm...Stefano Rocco, Roberto Bentivoglio - Scala in increasingly demanding environm...
Stefano Rocco, Roberto Bentivoglio - Scala in increasingly demanding environm...
 
Federico Feroldi - Scala microservices
Federico Feroldi - Scala microservicesFederico Feroldi - Scala microservices
Federico Feroldi - Scala microservices
 
Daniela Sfregola - Intro to Akka
Daniela Sfregola - Intro to AkkaDaniela Sfregola - Intro to Akka
Daniela Sfregola - Intro to Akka
 
Mirco Dotta - Akka Streams
Mirco Dotta - Akka StreamsMirco Dotta - Akka Streams
Mirco Dotta - Akka Streams
 
Phil Calçado - Your microservice as a function
Phil Calçado - Your microservice as a functionPhil Calçado - Your microservice as a function
Phil Calçado - Your microservice as a function
 
Scalatra - Massimiliano Dessì (Energeya)
Scalatra - Massimiliano Dessì (Energeya)Scalatra - Massimiliano Dessì (Energeya)
Scalatra - Massimiliano Dessì (Energeya)
 
Scala: the language of languages - Mario Fusco (Red Hat)
Scala: the language of languages - Mario Fusco (Red Hat)Scala: the language of languages - Mario Fusco (Red Hat)
Scala: the language of languages - Mario Fusco (Red Hat)
 
Reflection in Scala Whats, Whys and Hows - Walter Cazzola (Dipartimento di In...
Reflection in Scala Whats, Whys and Hows - Walter Cazzola (Dipartimento di In...Reflection in Scala Whats, Whys and Hows - Walter Cazzola (Dipartimento di In...
Reflection in Scala Whats, Whys and Hows - Walter Cazzola (Dipartimento di In...
 
Simplifying development-short - Mirco Dotta (Typesafe)
Simplifying development-short - Mirco Dotta (Typesafe)Simplifying development-short - Mirco Dotta (Typesafe)
Simplifying development-short - Mirco Dotta (Typesafe)
 
Scala in pratica - Stefano Rocco (MoneyFarm)
Scala in pratica - Stefano Rocco (MoneyFarm)Scala in pratica - Stefano Rocco (MoneyFarm)
Scala in pratica - Stefano Rocco (MoneyFarm)
 

Recently uploaded

Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGSujit Pal
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 

Recently uploaded (20)

Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAG
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 

Martin Odersky - Evolution of Scala

  • 1. The Evolution of Scala Martin Odersky Scala Italy 2015
  • 2. “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
  • 4. 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 4
  • 5. 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. 5
  • 6. 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 <..>
  • 7. 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.
  • 8. 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. 8
  • 9. •  Scala’s core is its type system. •  Most of the advanced types concepts are about flexibility, less so about safety. 2nd Invariant: It’s about the Types 9 Flexibility / Ease of Use Safety Scala Trend in Type-systems Goals of PL design where we’d like it to move
  • 12. New Environment: Scala.JS Feb 5, 2015: Scala.JS 0.6 released No longer experimental! Fast Great interop with Javascript libraries
  • 13. 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.
  • 14. 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
  • 15. With: •  New debugger •  Faster builds •  Integrated ScalaDoc
  • 16. IntelliJ 14.0 Scala plugin With a cool implicit tracker
  • 19. Where It Is Going?
  • 20. Emergence of a platform •  Core libraries •  Specifications: •  Futures •  Reactive Streams •  Spores •  Common vocabulary à Beginnings of a reactive platform, analogous to Java EE
  • 21. Java Source Classfiles Native code JDK: The Core of the Java Platform javac JDK JIT
  • 22. 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?
  • 23. Picture so far: Scala Source Classfiles + Scala Signatures Native code Scala piggybacks on the JDK scalac JDK JIT
  • 24. 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?
  • 25. Scala Source TASTY Minimized JavaScript Classfiles Native code Native Code A Scala-Specific Platform packaging tool / linker JDK JIT scalac JS JIT
  • 26. •  TASTY: Serialized Typed Abstract Syntax Trees •  E.g., here’s a TAST for x  +  2     The Core Apply   Select   Ident   “+”   “x”   ::   Literal   Nil   2 Int   (Int)Int   Int(2)   Int  
  • 27. Serialized TASTY File Format 27 A reference format for analysis + transformation 
 of Scala code high-level complete detailed.
  • 28. def  plus2(x:  Int)  =  x  +  2 becomes Overall: TASTY trees take up ~25% of classfile size Example: 28 x  +  2  
  • 29. What We Can Do With It Applications: •  instrumentation •  optimization •  code analysis •  refactoring Publish once, run everywhere. Automated remapping to solve binary compatibility issues.
  • 31. Connect the Dots DOT: A calculus for Papers in FOOL ‘12, OOPSLA ’14.
 Work on developing a fully expressive machine-verified version 
 is still onoping. dotc: A compiler for a cleaned up version of Scala. lampepfl/dotty on Github 31
  • 32. DOT (in FOOL ‘12)
  • 33. dotc: Cleaning up Scala XML Literals à String interpolation xml”””<A>this  slide</A>”””     Procedure Syntax à _ Early initializers à Trait parameters trait  2D(x:  Double,  y:  Double)  
  • 34. More Simplifications Existential types   List[T]  forSome  {  type  T},  List[_]   Higher-kinded types List   à Type with uninstantiated type members List  
  • 35. expands to Type Parameters as Syntactic Sugar class  List[T]  {  ...  }   class  List  {        type  List$T      private  type  T  =  List$T     }  
  • 36. expands to General Higher-Kinded Types 
 through Typed Lambdas type  Two[T]  =  (T,  T)   type  Two  =  Lambda  {      type  hk$Arg      type  Apply  =  (hk$arg,  hk$arg)   }  
  • 37. expands to General Higher-Kinded Types 
 through Typed Lambdas Two[String]   Two  {        type  hk$Arg  =  String     }  #  Apply  
  • 38. New Concepts Type unions (T&U) and intersections (T|U)   •  replace compound types (T with U) •  Eliminate potential of blow-up in least upper bound / greatest lower bound operations •  Make the type system cleaner and more regular (e.g. intersection, union are commutative). •  But pose new challenges for compilation. E.g. class  A  {  def  x  =  1  }   class  B  {  def  x  =  2  }        val  ab:  A  |  B  =  ???        ab.x      // which x gets called?
  • 39. Status Compiler close to completion Should have an alpha release by ScalaDays Amsterdam Plan to use TASTY for 
 merging dotc and scalac.
  • 41. 1. Implicits that compose We already have implicit lambdas implicit  x  =>  t      implicit  transaction  =>  body   What about if we also allow implicit function types? implicit  Transaction  =>  Result   Then we can abstract over implicits: type  Transactional[R]  =  implicit  Transaction  =>  R   Types like these compose, e.g. type  TransactionalIO[R]  =  Transactional[IO[R]]  
  • 42. expands to New Rule: 
 
 If the expected type of an expression E is an implicit function, E is automatically expanded to an implicit closure. def  f:  Transactional[R]  =  body   def  f:  Transactional[R]  =        implicit  _:  Transaction[R]  =>  body  
  • 43. 2. Better Treatment of effects So far, purity in Scala is by convention, not by coercion. In that sense, Scala is not a pure functional language. We’d like to explore “scalarly” ways to express effects of functions. Effects can be quite varied, e.g.
 - Mutation
 - IO
 - Exceptions
 - Null-dereferencing, ...
 Two essential properties: - they are additive,
 - they propagate along the call-graph.
  • 44. ` “Though Shalt Use Monads for Effects” Monads are cool But for Scala I hope we find something even better. •  Monads don’t commute. •  Require monad transformers for composition. •  I tried to wrap my head around it, but then it exploded.
  • 45. use this Idea: Use implicits to model effects as capabilities
 
 def  f:  R  throws  Exc  =  ...   def  f(implicit  t:  CanThrow[Exc]):  R  =  ...   instead of this type  throws[R,  Exc]  =        implicit  CanThrow[Exc]  =>  R   or add this to get back to this!
  • 46. In Summary Scala -  established functional programming in the mainstream, -  showed that a fusion with object-oriented programming is possible and useful, -  promoted the adoption of strong static typing, -  has lots of enthusiastic users, conference attendees included. Despite it being 10 years out it has few close competitors. 46
  • 47. Our Aims •  Make the platform more powerful •  Make the language simpler •  Work on foundations to get to the essence of Scala. Let’s continue to work together to achieve this. Thank You!