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
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Daniela Sfregola
October 23, 2021
Programming
230
0
Share
Scala 3 - A Quick Tour - Scala Italy 2021
Daniela Sfregola
October 23, 2021
More Decks by Daniela Sfregola
See All by Daniela Sfregola
Scala 3 - A Quick Tour - Singapore Scala Programmers 2021
danielasfregola
1
130
ScalaBase 2021- FP: the Good, the Bad, the Ugly
danielasfregola
0
210
Top 5 Cool Things about Scala 3 (that are not enums)
danielasfregola
0
240
LSUG 2019 - FP: The Good, The Bad and The Ugly
danielasfregola
2
310
Scala IO 2019 - FP: The Good, The Bad and The Ugly
danielasfregola
1
870
Scala Days 2019 - Refactor all the things!
danielasfregola
0
300
Refactor all the things!
danielasfregola
0
530
Scala Italy 2018 - Random Data Generation with ScalaCheck
danielasfregola
0
1.8k
Scala Days 2018 Berlin - A Pragmatic Introduction to Category Theory
danielasfregola
2
1.4k
Other Decks in Programming
See All in Programming
密結合なバックエンドから TypeScript のコードを生成する
kemuridama
1
330
プラグインで拡張される Context をtype-safe にする難しさと設計判断
kazupon
2
290
要はバランスからの卒業 #yumemi_grow
kajitack
0
190
開発とはなにか、Essenceカーネルで見えるもの
ukin0k0
0
200
The Arts and Crafts of Work in the AI Era — Toward Mastery in Software Development
kuranuki
0
250
新規プロダクトを高速で生み出すハーネスエンジニアリング
seanchas116
3
270
サークル参加から学ぶ、小さな事業の回し方
yuzneri
0
230
空間オーディオの活用
objectiveaudio
0
170
AIチームを指揮するOSS「TAKT」活用術 / How to Use “TAKT,” an OSS Tool for Orchestrating AI Teams
nrslib
4
610
サーバーレスで作る、動画データ管理基盤
oyasumipants
0
240
バックエンドにElysiaJSを採用して気付いた、良い点・悪い点
wanko_it
1
160
サプライチェーン攻撃対策「層を重ねて落ちない壁」を10日間で組み上げた話 #TechLeadConf2026
kashewnuts
1
360
Featured
See All Featured
HDC tutorial
michielstock
2
670
Designing Experiences People Love
moore
143
24k
Heart Work Chapter 1 - Part 1
lfama
PRO
7
36k
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
1
5.8k
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
180
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
35k
Leading Effective Engineering Teams in the AI Era
addyosmani
9
1.9k
What’s in a name? Adding method to the madness
productmarketing
PRO
24
4k
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
1
360
Visualization
eitanlees
151
17k
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
0
120
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
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"