Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Scala 3 - A Quick Tour - Scala Italy 2021
Search
Daniela Sfregola
October 23, 2021
Programming
0
190
Scala 3 - A Quick Tour - Scala Italy 2021
Daniela Sfregola
October 23, 2021
Tweet
Share
More Decks by Daniela Sfregola
See All by Daniela Sfregola
Scala 3 - A Quick Tour - Singapore Scala Programmers 2021
danielasfregola
1
110
ScalaBase 2021- FP: the Good, the Bad, the Ugly
danielasfregola
0
160
Top 5 Cool Things about Scala 3 (that are not enums)
danielasfregola
0
200
LSUG 2019 - FP: The Good, The Bad and The Ugly
danielasfregola
2
250
Scala IO 2019 - FP: The Good, The Bad and The Ugly
danielasfregola
1
800
Scala Days 2019 - Refactor all the things!
danielasfregola
0
270
Refactor all the things!
danielasfregola
0
450
Scala Italy 2018 - Random Data Generation with ScalaCheck
danielasfregola
0
1.7k
Scala Days 2018 Berlin - A Pragmatic Introduction to Category Theory
danielasfregola
2
1.2k
Other Decks in Programming
See All in Programming
LINEヤフー データグループ紹介
lycorp_recruit_jp
0
800
What Spring Developers Should Know About Jakarta EE
ivargrimstad
0
210
Azure AI Foundryではじめてのマルチエージェントワークフロー
seosoft
0
120
deno-redisの紹介とJSRパッケージの運用について (toranoana.deno #21)
uki00a
0
140
なぜ「共通化」を考え、失敗を繰り返すのか
rinchoku
1
470
KotlinConf 2025 現地で感じたServer-Side Kotlin
n_takehata
1
230
Webの外へ飛び出せ NativePHPが切り拓くPHPの未来
takuyakatsusa
2
320
Java on Azure で LangGraph!
kohei3110
0
170
エンジニア向け採用ピッチ資料
inusan
0
160
つよそうにふるまい、つよい成果を出すのなら、つよいのかもしれない
irof
1
300
AIコーディング道場勉強会#2 君(エンジニア)たちはどう生きるか
misakiotb
1
240
PHPで始める振る舞い駆動開発(Behaviour-Driven Development)
ohmori_yusuke
2
170
Featured
See All Featured
GraphQLとの向き合い方2022年版
quramy
47
14k
Reflections from 52 weeks, 52 projects
jeffersonlam
351
20k
Building Applications with DynamoDB
mza
95
6.5k
Facilitating Awesome Meetings
lara
54
6.4k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
331
22k
Writing Fast Ruby
sferik
628
61k
How GitHub (no longer) Works
holman
314
140k
Side Projects
sachag
455
42k
Building Adaptive Systems
keathley
43
2.6k
Thoughts on Productivity
jonyablonski
69
4.7k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
26k
Building a Modern Day E-commerce SEO Strategy
aleyda
41
7.3k
Transcript
Scala 3 A Quick Tour @DanielaSfregola Scala Italy - October
2021
Hellooooo • Software Engineer living in London UK •
Scala Lover ❤ • OS Maintainer • Author of "Get Programming with Scala" by Manning 35% OFF on EVERYTHING with code "ctwscalait21"
Scala 3 is here! • After 8 years of work
• 28,000 commits • 7,400 pull requests • 4,100 closed issues • ...released on May 13th, 2021! https://www.scala-lang.org/blog/2021/05/14/scala3-is-here.html
An overview • https://dotty.ep fl .ch/docs/reference/overview.html
@main Annotation object HelloWorld extends App { println("Hello World!" )
}
@main Annotation object HelloWorld extends App { println("Hello World!" )
} object HelloWorld { @main def hello: Unit = { println("Hello world!" ) } }
@main Annotation object HelloWorld extends App { println("Hello World!" )
} object HelloWorld { @main def hello: Unit = { println("Hello world!" ) } } object Hello { @main def echo(n: Int, word: String): Unit = { println(word * n ) } }
Parametrized Traits trait Nameable { def name: Strin g }
Parametrized Traits trait Nameable { def name: Strin g }
trait Nameable(name: String)
Intersection Types class A class B def foo: A &
B = ???
Union Types class A class B def foo: A |
B = ???
Package Object // in file my/demo/package.scal a package m y
package object demo { def customLog(msg: String) { println(s"Customised package log: $msg" ) } }
Package Object // in file my/demo/package.scal a package m y
package object demo { def customLog(msg: String) { println(s"Customised package log: $msg" ) } } [ DROPPED ]
Enums sealed abstract class Color(val rgb: Int) case object Red
extends Color(0xFF0000 ) case object Green extends Color(0x00FF00 ) case object Blue extends Color(0x0000FF)
Enums sealed abstract class Color(val rgb: Int) case object Red
extends Color(0xFF0000 ) case object Green extends Color(0x00FF00 ) case object Blue extends Color(0x0000FF) enum Color(val rgb: Int) : case Red extends Color(0xFF0000 ) case Green extends Color(0x00FF00 ) case Blue extends Color(0x0000FF)
Improved Type Inference Map("Scala" -> 3).map { (k, v) =>
s"$k$v" }
Improved Type Inference Map("Scala" -> 3).map { (k, v) =>
s"$k$v" } Scala 2.13.4
Improved Type Inference Map("Scala" -> 3).map { (k, v) =>
s"$k$v" } Scala 2.13.4
Improved Type Inference Map("Scala" -> 3).map { (k, v) =>
s"$k$v" } Scala 3.0.0
Improved Type Inference Map("Scala" -> 3).map { (k, v) =>
s"$k$v" } Scala 3.0.0 Scala 2.13.4
Procedure Syntax def echo(str: String) { st r }
Procedure Syntax def echo(str: String) { st r } Scala
2.13.4
Procedure Syntax def echo(str: String) { st r } Scala
2.13.4
Procedure Syntax def echo(str: String) { st r } Scala
3
Procedure Syntax def echo(str: String) { st r } Scala
3
Improved Error Messages Arrested Developers What the Scala Compiler &
Lucille Bluth Have In Common by Fiona Condon, NeScala 2017 https://www.youtube.com/watch?v=78iIbiRwFTM
Improved Error Messages def echo(str: String): Unit = { st
r } def echoTwice(str: String): String = { echo(str) match { case x: String => s"$x$x " } }
Improved Error Messages Scala 2.13.4
Improved Error Messages Scala 2.13.4 Scala 3
Strict Equality List("Scala", "3").headOption == "Scala"
Strict Equality List("Scala", "3").headOption == "Scala" Scala 2.13.4
Strict Equality List("Scala", "3").headOption == "Scala" Scala 2.13.4 Scala 3
Compatibility with 2.13 Migrating to Scala 3 is easy* !
* if you are using Scala 2.13 * if you don't have macros in your code Scala 3 Migration Guide https://docs.scala-lang.org/scala3/guides/migration
Thank You! •Twitter: @DanielaSfregola •"Get Programming with Scala" by
Manning 35% OFF on EVERYTHING with code "ctwscalait21"