SlideShare a Scribd company logo
1 of 48
Scala
Where It Came From
Where It is Going
Martin Odersky
Scala Days San Francisco
Scala
Where It Came From
Martin Odersky
Scala Days San Francisco
“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
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.
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 <..>
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.
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
10
Flexibility / Ease of Use
Safety
Scala
Trend in Type-systems
Goals of PL design
where we’d like it to move
The Present
12
An Emergent Ecosystem
Scala
Akka
Play
Slick
Spark
JVM
Kafka
Mesos
Chisel
scalaz
cats
scaldin
g
ScalaCheck
scodec
Specs
squeryl
Samza
Finagle
ScalaTe
st
shapele
sssbt
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
28
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:
29
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
32
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 toexpands toexpands toexpands to
Type Parameters as Syntactic Sugar
class List[T] { ... }
class List {
type List$T
private type T = List$T
}
expands toexpands toexpands toexpands 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 toexpands toexpands toexpands 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 toexpands toexpands toexpands 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 thisuse thisuse thisuse this
Idea: Use implicits to model effects as
capabilities
def f: R throws Exc = ...
def f(implicit t: CanThrow[Exc]): R = ...
instead of thisinstead of thisinstead of thisinstead of this
type throws[R, Exc] =
implicit CanThrow[Exc] => R
or add thisor add thisor add thisor add this
to get back to this!to get back to this!to get back to 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.
47
Our Aims
• Make the platform more powerful
• Make the language simplier
• 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

The Evolution of Scala / Scala進化論
The Evolution of Scala / Scala進化論The Evolution of Scala / Scala進化論
The Evolution of Scala / Scala進化論scalaconfjp
 
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
 
Scala - The Simple Parts, SFScala presentation
Scala - The Simple Parts, SFScala presentationScala - The Simple Parts, SFScala presentation
Scala - The Simple Parts, SFScala presentationMartin Odersky
 
Scala : language of the future
Scala : language of the futureScala : language of the future
Scala : language of the futureAnsviaLab
 
Scala Talk at FOSDEM 2009
Scala Talk at FOSDEM 2009Scala Talk at FOSDEM 2009
Scala Talk at FOSDEM 2009Martin Odersky
 
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
 
A Scala tutorial
A Scala tutorialA Scala tutorial
A Scala tutorialDima Statz
 
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
 
The Evolution of Scala
The Evolution of ScalaThe Evolution of Scala
The Evolution of ScalaMartin Odersky
 
Spark schema for free with David Szakallas
Spark schema for free with David SzakallasSpark schema for free with David Szakallas
Spark schema for free with David SzakallasDatabricks
 
JVM languages "flame wars"
JVM languages "flame wars"JVM languages "flame wars"
JVM languages "flame wars"Gal Marder
 
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 Spark SQL and Catalyst / Spark SQLおよびCalalystの紹介
Introduction to Spark SQL and Catalyst / Spark SQLおよびCalalystの紹介Introduction to Spark SQL and Catalyst / Spark SQLおよびCalalystの紹介
Introduction to Spark SQL and Catalyst / Spark SQLおよびCalalystの紹介scalaconfjp
 
An Introduction to Higher Order Functions in Spark SQL with Herman van Hovell
An Introduction to Higher Order Functions in Spark SQL with Herman van HovellAn Introduction to Higher Order Functions in Spark SQL with Herman van Hovell
An Introduction to Higher Order Functions in Spark SQL with Herman van HovellDatabricks
 
flatMap Oslo presentation slides
flatMap Oslo presentation slidesflatMap Oslo presentation slides
flatMap Oslo presentation slidesMartin Odersky
 
Introduction to Scala
Introduction to ScalaIntroduction to Scala
Introduction to ScalaRahul Jain
 

What's hot (19)

The Evolution of Scala / Scala進化論
The Evolution of Scala / Scala進化論The Evolution of Scala / Scala進化論
The Evolution of Scala / Scala進化論
 
Introduction to Scala
Introduction to ScalaIntroduction to Scala
Introduction to Scala
 
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
 
Scala - The Simple Parts, SFScala presentation
Scala - The Simple Parts, SFScala presentationScala - The Simple Parts, SFScala presentation
Scala - The Simple Parts, SFScala presentation
 
Scala Days NYC 2016
Scala Days NYC 2016Scala Days NYC 2016
Scala Days NYC 2016
 
Spark workshop
Spark workshopSpark workshop
Spark workshop
 
Scala : language of the future
Scala : language of the futureScala : language of the future
Scala : language of the future
 
Scala Talk at FOSDEM 2009
Scala Talk at FOSDEM 2009Scala Talk at FOSDEM 2009
Scala Talk at FOSDEM 2009
 
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
 
A Scala tutorial
A Scala tutorialA Scala tutorial
A Scala tutorial
 
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
 
The Evolution of Scala
The Evolution of ScalaThe Evolution of Scala
The Evolution of Scala
 
Spark schema for free with David Szakallas
Spark schema for free with David SzakallasSpark schema for free with David Szakallas
Spark schema for free with David Szakallas
 
JVM languages "flame wars"
JVM languages "flame wars"JVM languages "flame wars"
JVM languages "flame wars"
 
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 Spark SQL and Catalyst / Spark SQLおよびCalalystの紹介
Introduction to Spark SQL and Catalyst / Spark SQLおよびCalalystの紹介Introduction to Spark SQL and Catalyst / Spark SQLおよびCalalystの紹介
Introduction to Spark SQL and Catalyst / Spark SQLおよびCalalystの紹介
 
An Introduction to Higher Order Functions in Spark SQL with Herman van Hovell
An Introduction to Higher Order Functions in Spark SQL with Herman van HovellAn Introduction to Higher Order Functions in Spark SQL with Herman van Hovell
An Introduction to Higher Order Functions in Spark SQL with Herman van Hovell
 
flatMap Oslo presentation slides
flatMap Oslo presentation slidesflatMap Oslo presentation slides
flatMap Oslo presentation slides
 
Introduction to Scala
Introduction to ScalaIntroduction to Scala
Introduction to Scala
 

Similar to Scala Days San Francisco

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
 
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.
 
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 for n00bs by a n00b.
Scala for n00bs by a n00b.Scala for n00bs by a n00b.
Scala for n00bs by a n00b.brandongulla
 
A Tour Of Scala
A Tour Of ScalaA Tour Of Scala
A Tour Of Scalafanf42
 
A Brief, but Dense, Intro to Scala
A Brief, but Dense, Intro to ScalaA Brief, but Dense, Intro to Scala
A Brief, but Dense, Intro to ScalaDerek Chen-Becker
 
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
 
Refactoring to Scala DSLs and LiftOff 2009 Recap
Refactoring to Scala DSLs and LiftOff 2009 RecapRefactoring to Scala DSLs and LiftOff 2009 Recap
Refactoring to Scala DSLs and LiftOff 2009 RecapDave Orme
 
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)
 
Scala overview
Scala overviewScala overview
Scala overviewSteve Min
 
Metaprogramming in Scala 2.10, Eugene Burmako,
Metaprogramming  in Scala 2.10, Eugene Burmako, Metaprogramming  in Scala 2.10, Eugene Burmako,
Metaprogramming in Scala 2.10, Eugene Burmako, Vasil Remeniuk
 
Scala - from "Hello, World" to "Heroku Scale"
Scala - from "Hello, World" to "Heroku Scale"Scala - from "Hello, World" to "Heroku Scale"
Scala - from "Hello, World" to "Heroku Scale"Salesforce Developers
 

Similar to Scala Days San Francisco (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
 
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
 
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
 
Flatmap
FlatmapFlatmap
Flatmap
 
Scala for n00bs by a n00b.
Scala for n00bs by a n00b.Scala for n00bs by a n00b.
Scala for n00bs by a n00b.
 
A Tour Of Scala
A Tour Of ScalaA Tour Of Scala
A Tour Of Scala
 
Scala-Ls1
Scala-Ls1Scala-Ls1
Scala-Ls1
 
A Brief, but Dense, Intro to Scala
A Brief, but Dense, Intro to ScalaA Brief, but Dense, Intro to Scala
A Brief, but Dense, Intro to Scala
 
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
 
Refactoring to Scala DSLs and LiftOff 2009 Recap
Refactoring to Scala DSLs and LiftOff 2009 RecapRefactoring to Scala DSLs and LiftOff 2009 Recap
Refactoring to Scala DSLs and LiftOff 2009 Recap
 
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 ...
 
Scala overview
Scala overviewScala overview
Scala overview
 
Preparing for Scala 3
Preparing for Scala 3Preparing for Scala 3
Preparing for Scala 3
 
Metaprogramming in Scala 2.10, Eugene Burmako,
Metaprogramming  in Scala 2.10, Eugene Burmako, Metaprogramming  in Scala 2.10, Eugene Burmako,
Metaprogramming in Scala 2.10, Eugene Burmako,
 
Scala - from "Hello, World" to "Heroku Scale"
Scala - from "Hello, World" to "Heroku Scale"Scala - from "Hello, World" to "Heroku Scale"
Scala - from "Hello, World" to "Heroku Scale"
 

More from Martin Odersky

Capabilities for Resources and Effects
Capabilities for Resources and EffectsCapabilities for Resources and Effects
Capabilities for Resources and EffectsMartin Odersky
 
What To Leave Implicit
What To Leave ImplicitWhat To Leave Implicit
What To Leave ImplicitMartin Odersky
 
What To Leave Implicit
What To Leave ImplicitWhat To Leave Implicit
What To Leave ImplicitMartin Odersky
 
Implementing Higher-Kinded Types in Dotty
Implementing Higher-Kinded Types in DottyImplementing Higher-Kinded Types in Dotty
Implementing Higher-Kinded Types in DottyMartin Odersky
 
Compilers Are Databases
Compilers Are DatabasesCompilers Are Databases
Compilers Are DatabasesMartin Odersky
 

More from Martin Odersky (8)

scalar.pdf
scalar.pdfscalar.pdf
scalar.pdf
 
Capabilities for Resources and Effects
Capabilities for Resources and EffectsCapabilities for Resources and Effects
Capabilities for Resources and Effects
 
Simplicitly
SimplicitlySimplicitly
Simplicitly
 
What To Leave Implicit
What To Leave ImplicitWhat To Leave Implicit
What To Leave Implicit
 
What To Leave Implicit
What To Leave ImplicitWhat To Leave Implicit
What To Leave Implicit
 
From DOT to Dotty
From DOT to DottyFrom DOT to Dotty
From DOT to Dotty
 
Implementing Higher-Kinded Types in Dotty
Implementing Higher-Kinded Types in DottyImplementing Higher-Kinded Types in Dotty
Implementing Higher-Kinded Types in Dotty
 
Compilers Are Databases
Compilers Are DatabasesCompilers Are Databases
Compilers Are Databases
 

Recently uploaded

Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Velvetech LLC
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...Technogeeks
 
PREDICTING RIVER WATER QUALITY ppt presentation
PREDICTING  RIVER  WATER QUALITY  ppt presentationPREDICTING  RIVER  WATER QUALITY  ppt presentation
PREDICTING RIVER WATER QUALITY ppt presentationvaddepallysandeep122
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...confluent
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceBrainSell Technologies
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfStefano Stabellini
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalLionel Briand
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Rob Geurden
 
Comparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfComparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfDrew Moseley
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEEVICTOR MAESTRE RAMIREZ
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Angel Borroy López
 
Machine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringMachine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringHironori Washizaki
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based projectAnoyGreter
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commercemanigoyal112
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaHanief Utama
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprisepreethippts
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Natan Silnitsky
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesŁukasz Chruściel
 

Recently uploaded (20)

Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...
 
PREDICTING RIVER WATER QUALITY ppt presentation
PREDICTING  RIVER  WATER QUALITY  ppt presentationPREDICTING  RIVER  WATER QUALITY  ppt presentation
PREDICTING RIVER WATER QUALITY ppt presentation
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. Salesforce
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdf
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive Goal
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...
 
Comparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfComparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdf
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEE
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
 
Machine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringMachine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their Engineering
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based project
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commerce
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprise
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New Features
 

Scala Days San Francisco

  • 1. Scala Where It Came From Where It is Going Martin Odersky Scala Days San Francisco
  • 2. Scala Where It Came From Martin Odersky Scala Days San Francisco
  • 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. • 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 10 Flexibility / Ease of Use Safety Scala Trend in Type-systems Goals of PL design where we’d like it to move
  • 13. New Environment: Scala.JS Feb 5, 2015: Scala.JS 0.6 released No longer experimental! Fast Great interop with Javascript libraries
  • 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
  • 17. IntelliJ 14.0 Scala plugin With a cool implicit tracker
  • 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. Java Source Classfiles Native code JDK: The Core of the Java Platform javac JDK JIT
  • 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. Picture so far: Scala Source Classfiles + Scala Signatures Native code Scala piggybacks on the JDK scalac JDK JIT
  • 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?
  • 26. Scala Source TASTY Minimized JavaScript Classfiles Native code Native Code A Scala-Specific Platform packaging tool / linker JDK JIT scalac JS JIT
  • 27. • 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
  • 28. Serialized TASTY File Format 28 A reference format for analysis + transformation of Scala code high-level complete detailed.
  • 29. def plus2(x: Int) = x + 2 becomes Overall: TASTY trees take up ~25% of classfile size Example: 29 x + 2
  • 30. What We Can Do With It Applications: • instrumentation • optimization • code analysis • refactoring Publish once, run everywhere. Automated remapping to solve binary compatibility issues.
  • 32. 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 32
  • 33. DOT (in FOOL ‘12)
  • 34. 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)
  • 35. More Simplifications Existential types List[T] forSome { type T}, List[_] Higher-kinded types List  Type with uninstantiated type members List
  • 36. expands toexpands toexpands toexpands to Type Parameters as Syntactic Sugar class List[T] { ... } class List { type List$T private type T = List$T }
  • 37. expands toexpands toexpands toexpands 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) }
  • 38. expands toexpands toexpands toexpands to General Higher-Kinded Types through Typed Lambdas Two[String] Two { type hk$Arg = String } # Apply
  • 39. 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?
  • 40. Status Compiler close to completion Should have an alpha release by ScalaDays Amsterdam Plan to use TASTY for merging dotc and scalac.
  • 42. 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]]
  • 43. expands toexpands toexpands toexpands 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
  • 44. 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.
  • 45. ` “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.
  • 46. use thisuse thisuse thisuse this Idea: Use implicits to model effects as capabilities def f: R throws Exc = ... def f(implicit t: CanThrow[Exc]): R = ... instead of thisinstead of thisinstead of thisinstead of this type throws[R, Exc] = implicit CanThrow[Exc] => R or add thisor add thisor add thisor add this to get back to this!to get back to this!to get back to this!to get back to this!
  • 47. 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. 47
  • 48. Our Aims • Make the platform more powerful • Make the language simplier • Work on foundations to get to the essence of Scala. Let’s continue to work together to achieve this. Thank You!