-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfeatures-classification.html
172 lines (172 loc) · 42.6 KB
/
features-classification.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
<!DOCTYPE html><html data-githubContributorsUrl="https://api.github.com/repos/scala/scala3" data-githubContributorsFilename="docs/_docs/reference/features-classification.md" data-pathToRoot="" data-rawLocation="features-classification" data-dynamicSideMenu="false"><head><meta charset="utf-8"></meta><meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"></meta><title>A Classification of Proposed Language Features</title><link rel="shortcut icon" type="image/x-icon" href="favicon.ico"></link><script type="text/javascript" src="scripts/theme.js"></script><script type="text/javascript" src="scripts/searchData.js" defer="true"></script><script type="text/javascript" src="scripts/scastieConfiguration.js" defer="true"></script><link rel="stylesheet" href="styles/theme/bundle.css"></link><link rel="stylesheet" href="styles/theme/components/bundle.css"></link><link rel="stylesheet" href="styles/theme/components/button/bundle.css"></link><link rel="stylesheet" href="styles/theme/layout/bundle.css"></link><link rel="stylesheet" href="styles/nord-light.css"></link><link rel="stylesheet" href="styles/dotty-icons.css"></link><link rel="stylesheet" href="styles/filter-bar.css"></link><link rel="stylesheet" href="styles/code-snippets.css"></link><link rel="stylesheet" href="styles/searchbar.css"></link><link rel="stylesheet" href="styles/social-links.css"></link><link rel="stylesheet" href="styles/versions-dropdown.css"></link><link rel="stylesheet" href="styles/content-contributors.css"></link><link rel="stylesheet" href="styles/fontawesome.css"></link><script type="text/javascript" src="hljs/highlight.pack.js" defer="true"></script><script type="text/javascript" src="scripts/hljs-scala3.js" defer="true"></script><script type="text/javascript" src="scripts/ux.js" defer="true"></script><script type="text/javascript" src="scripts/common/component.js" defer="true"></script><script type="text/javascript" src="scripts/common/utils.js" defer="true"></script><script type="text/javascript" src="scripts/components/FilterBar.js" defer="true"></script><script type="text/javascript" src="scripts/components/DocumentableList.js" defer="true"></script><script type="text/javascript" src="scripts/components/Input.js" defer="true"></script><script type="text/javascript" src="scripts/components/FilterGroup.js" defer="true"></script><script type="text/javascript" src="scripts/components/Filter.js" defer="true"></script><script type="text/javascript" src="scripts/scaladoc-scalajs.js" defer="true"></script><script type="text/javascript" src="scripts/contributors.js" defer="true"></script><script type="text/javascript" src="https://code.jquery.com/jquery-3.5.1.min.js" defer="true"></script><script type="text/javascript" src="https://d3js.org/d3.v6.min.js" defer="true"></script><script type="text/javascript" src="https://cdn.jsdelivr.net/npm/[email protected]/dist/graphlib-dot.min.js" defer="true"></script><script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/dagre-d3/0.6.1/dagre-d3.min.js" defer="true"></script><script type="text/javascript" src="https://scastie.scala-lang.org/embedded.js" defer="true"></script><script type="text/javascript" src="scripts/data.js" defer="true"></script><link rel="stylesheet" href="styles/staticsitestyles.css"></link><script>var pathToRoot = "";</script><link rel="dns-prefetch" href="//fonts.googleapis.com">
<link rel="preconnect" href="https://cdnjs.cloudflare.com" crossorigin>
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="stylesheet" href="/css/dottydoc.css"></head><body><div id=""><div id="header" class="body-small"><div class="header-container-left"><a href="" class="logo-container"><span id="project-logo" class="project-logo"><img src="project-logo/logo.svg"></img></span><span id="dark-project-logo" class="project-logo"><img src="project-logo/logo_dark.svg"></img></span><span class="project-name h300">Scala 3 Reference</span></a><span onclick="dropdownHandler(event)" class="text-button with-arrow" id="dropdown-trigger"><a><div class="projectVersion">3.6.3</div></a></span><div id="version-dropdown" class="dropdown-menu"></div></div><div class="header-container-right"><button id="search-toggle" class="icon-button"></button><a href="https://docs.scala-lang.org/" class="text-button">Learn</a><a href="https://www.scala-lang.org/download/" class="text-button">Install</a><a href="https://scastie.scala-lang.org" class="text-button">Playground</a><a href="https://index.scala-lang.org" class="text-button">Find A Library</a><a href="https://www.scala-lang.org/community/" class="text-button">Community</a><a href="https://www.scala-lang.org/blog/" class="text-button">Blog</a><span id="theme-toggle" class="icon-button"></span><span id="mobile-menu-toggle" class="icon-button hamburger"></span></div></div><div id="mobile-menu"><div class="mobile-menu-header body-small"><span class="mobile-menu-logo"><span id="project-logo" class="project-logo"><img src="project-logo/logo.svg"></img></span><span id="dark-project-logo" class="project-logo"><img src="project-logo/logo_dark.svg"></img></span><span class="project-name h300">Scala 3 Reference</span></span><button id="mobile-menu-close" class="icon-button close"></button></div><div class="mobile-menu-container body-medium"><input id="mobile-scaladoc-searchbar-input" class="scaladoc-searchbar-input" type="search" placeholder="Find anything"></input><a href="https://docs.scala-lang.org/" class="mobile-menu-item">Learn</a><a href="https://www.scala-lang.org/download/" class="mobile-menu-item">Install</a><a href="https://scastie.scala-lang.org" class="mobile-menu-item">Playground</a><a href="https://index.scala-lang.org" class="mobile-menu-item">Find A Library</a><a href="https://www.scala-lang.org/community/" class="mobile-menu-item">Community</a><a href="https://www.scala-lang.org/blog/" class="mobile-menu-item">Blog</a><span id="mobile-theme-toggle" class="mobile-menu-item mode"></span></div></div><span id="mobile-sidebar-toggle" class="floating-button"></span><div id="leftColumn" class="body-small"><div class="switcher-container"><a id="docs-nav-button" class="switcher h100 selected" href="index.html">Docs</a></div><nav id="docs-nav" class="side-menu"><div class="ni n0"><span class="nh de"><button class="ar icon-button "></button><a href="new-types/index.html"><span>New Types</span></a></span><div class="ni n1 "><span class="nh de"><a href="new-types/intersection-types.html"><span>Intersection Types</span></a></span></div><div class="ni n1 "><span class="nh de"><a href="new-types/union-types.html"><span>Union Types</span></a></span></div><div class="ni n1 "><span class="nh de"><a href="new-types/type-lambdas.html"><span>Type Lambdas</span></a></span></div><div class="ni n1 "><span class="nh de"><a href="new-types/match-types.html"><span>Match Types</span></a></span></div><div class="ni n1 "><span class="nh de"><a href="new-types/dependent-function-types.html"><span>Dependent Function Types</span></a></span></div><div class="ni n1 "><span class="nh de"><a href="new-types/polymorphic-function-types.html"><span>Polymorphic Function Types</span></a></span></div></div><div class="ni n0"><span class="nh de"><button class="ar icon-button "></button><a href="enums/index.html"><span>Enums</span></a></span><div class="ni n1 "><span class="nh de"><a href="enums/enums.html"><span>Enumerations</span></a></span></div><div class="ni n1 "><span class="nh de"><a href="enums/adts.html"><span>Algebraic Data Types</span></a></span></div><div class="ni n1 "><span class="nh de"><a href="enums/desugarEnums.html"><span>Translation of Enums and ADTs</span></a></span></div></div><div class="ni n0"><span class="nh de"><button class="ar icon-button "></button><a href="contextual/index.html"><span>Contextual Abstractions</span></a></span><div class="ni n1 "><span class="nh de"><a href="contextual/givens.html"><span>Given Instances</span></a></span></div><div class="ni n1 "><span class="nh de"><a href="contextual/deferred-givens.html"><span>Deferred Givens</span></a></span></div><div class="ni n1 "><span class="nh de"><a href="contextual/more-givens.html"><span>Other Forms Of Givens</span></a></span></div><div class="ni n1 "><span class="nh de"><a href="contextual/previous-givens.html"><span>Previous Given Syntax</span></a></span></div><div class="ni n1 "><span class="nh de"><a href="contextual/using-clauses.html"><span>Using Clauses</span></a></span></div><div class="ni n1 "><span class="nh de"><a href="contextual/context-bounds.html"><span>Context Bounds</span></a></span></div><div class="ni n1 "><span class="nh de"><a href="contextual/given-imports.html"><span>Importing Givens</span></a></span></div><div class="ni n1 "><span class="nh de"><a href="contextual/extension-methods.html"><span>Extension Methods</span></a></span></div><div class="ni n1 "><span class="nh de"><a href="contextual/right-associative-extension-methods.html"><span>Right-Associative Extension Methods: Details</span></a></span></div><div class="ni n1 "><span class="nh de"><a href="contextual/type-classes.html"><span>Implementing Type classes</span></a></span></div><div class="ni n1 "><span class="nh de"><a href="contextual/derivation.html"><span>Type Class Derivation</span></a></span></div><div class="ni n1 "><span class="nh de"><a href="contextual/derivation-macro.html"><span>How to write a type class `derived` method using macros</span></a></span></div><div class="ni n1 "><span class="nh de"><a href="contextual/multiversal-equality.html"><span>Multiversal Equality</span></a></span></div><div class="ni n1 "><span class="nh de"><a href="contextual/context-functions.html"><span>Context Functions</span></a></span></div><div class="ni n1 "><span class="nh de"><a href="contextual/conversions.html"><span>Implicit Conversions</span></a></span></div><div class="ni n1 "><span class="nh de"><a href="contextual/by-name-context-parameters.html"><span>By-Name Context Parameters</span></a></span></div><div class="ni n1 "><span class="nh de"><a href="contextual/relationship-implicits.html"><span>Relationship with Scala 2 Implicits</span></a></span></div></div><div class="ni n0"><span class="nh de"><button class="ar icon-button "></button><a href="metaprogramming/index.html"><span>Metaprogramming</span></a></span><div class="ni n1 "><span class="nh de"><a href="metaprogramming/inline.html"><span>Inline</span></a></span></div><div class="ni n1 "><span class="nh de"><a href="metaprogramming/compiletime-ops.html"><span>Compile-time operations</span></a></span></div><div class="ni n1 "><span class="nh de"><a href="metaprogramming/macros.html"><span>Macros</span></a></span></div><div class="ni n1 "><span class="nh de"><a href="metaprogramming/staging.html"><span>Run-Time Multi-Stage Programming</span></a></span></div><div class="ni n1 "><span class="nh de"><a href="metaprogramming/reflection.html"><span>Reflection</span></a></span></div><div class="ni n1 "><span class="nh de"><a href="metaprogramming/tasty-inspect.html"><span>TASTy Inspection</span></a></span></div><div class="ni n1 "><span class="nh de"><a href="metaprogramming/simple-smp.html"><span>The Meta-theory of Symmetric Metaprogramming</span></a></span></div></div><div class="ni n0"><span class="nh de"><button class="ar icon-button "></button><a href="other-new-features/index.html"><span>Other New Features</span></a></span><div class="ni n1 "><span class="nh de"><a href="other-new-features/trait-parameters.html"><span>Trait Parameters</span></a></span></div><div class="ni n1 "><span class="nh de"><a href="other-new-features/transparent-traits.html"><span>Transparent Traits and Classes</span></a></span></div><div class="ni n1 "><span class="nh de"><a href="other-new-features/creator-applications.html"><span>Universal Apply Methods</span></a></span></div><div class="ni n1 "><span class="nh de"><a href="other-new-features/export.html"><span>Export Clauses</span></a></span></div><div class="ni n1 "><span class="nh de"><a href="other-new-features/opaques.html"><span>Opaque Type Aliases</span></a></span></div><div class="ni n1 "><span class="nh de"><a href="other-new-features/opaques-details.html"><span>Opaque Type Aliases: More Details</span></a></span></div><div class="ni n1 "><span class="nh de"><a href="other-new-features/open-classes.html"><span>Open Classes</span></a></span></div><div class="ni n1 "><span class="nh de"><a href="other-new-features/parameter-untupling.html"><span>Parameter Untupling</span></a></span></div><div class="ni n1 "><span class="nh de"><a href="other-new-features/kind-polymorphism.html"><span>Kind Polymorphism</span></a></span></div><div class="ni n1 "><span class="nh de"><a href="other-new-features/matchable.html"><span>The Matchable Trait</span></a></span></div><div class="ni n1 "><span class="nh de"><a href="other-new-features/threadUnsafe-annotation.html"><span>The @threadUnsafe annotation</span></a></span></div><div class="ni n1 "><span class="nh de"><a href="other-new-features/targetName.html"><span>The @targetName annotation</span></a></span></div><div class="ni n1 "><span class="nh de"><a href="other-new-features/control-syntax.html"><span>New Control Syntax</span></a></span></div><div class="ni n1 "><span class="nh de"><a href="other-new-features/indentation.html"><span>Optional Braces</span></a></span></div><div class="ni n1 "><span class="nh de"><a href="other-new-features/safe-initialization.html"><span>Safe Initialization</span></a></span></div><div class="ni n1 "><span class="nh de"><a href="other-new-features/type-test.html"><span>TypeTest</span></a></span></div><div class="ni n1 "><span class="nh de"><a href="other-new-features/experimental-defs.html"><span>Experimental Definitions</span></a></span></div><div class="ni n1 "><span class="nh de"><a href="other-new-features/binary-literals.html"><span>Binary Integer Literals</span></a></span></div></div><div class="ni n0"><span class="nh de"><button class="ar icon-button "></button><a href="changed-features/index.html"><span>Other Changed Features</span></a></span><div class="ni n1 "><span class="nh de"><a href="changed-features/numeric-literals.html"><span>Numeric Literals</span></a></span></div><div class="ni n1 "><span class="nh de"><a href="changed-features/structural-types.html"><span>Programmatic Structural Types</span></a></span></div><div class="ni n1 "><span class="nh de"><a href="changed-features/operators.html"><span>Rules for Operators</span></a></span></div><div class="ni n1 "><span class="nh de"><a href="changed-features/wildcards.html"><span>Wildcard Arguments in Types</span></a></span></div><div class="ni n1 "><span class="nh de"><a href="changed-features/imports.html"><span>Imports</span></a></span></div><div class="ni n1 "><span class="nh de"><a href="changed-features/type-inference.html"><span>Changes in Type Inference</span></a></span></div><div class="ni n1 "><span class="nh de"><a href="changed-features/implicit-resolution.html"><span>Changes in Implicit Resolution</span></a></span></div><div class="ni n1 "><span class="nh de"><a href="changed-features/implicit-conversions.html"><span>Implicit Conversions</span></a></span></div><div class="ni n1 "><span class="nh de"><a href="changed-features/overload-resolution.html"><span>Changes in Overload Resolution</span></a></span></div><div class="ni n1 "><span class="nh de"><a href="changed-features/match-syntax.html"><span>Match Expressions</span></a></span></div><div class="ni n1 "><span class="nh de"><a href="changed-features/vararg-splices.html"><span>Vararg Splices</span></a></span></div><div class="ni n1 "><span class="nh de"><a href="changed-features/pattern-bindings.html"><span>Pattern Bindings</span></a></span></div><div class="ni n1 "><span class="nh de"><a href="changed-features/pattern-matching.html"><span>Option-less pattern matching</span></a></span></div><div class="ni n1 "><span class="nh de"><a href="changed-features/eta-expansion.html"><span>Automatic Eta Expansion</span></a></span></div><div class="ni n1 "><span class="nh de"><a href="changed-features/compiler-plugins.html"><span>Changes in Compiler Plugins</span></a></span></div><div class="ni n1 "><span class="nh de"><a href="changed-features/lazy-vals-init.html"><span>Lazy Vals Initialization</span></a></span></div><div class="ni n1 "><span class="nh de"><a href="changed-features/main-functions.html"><span>Main Methods</span></a></span></div><div class="ni n1 "><span class="nh de"><a href="changed-features/interpolation-escapes.html"><span>Escapes in interpolations</span></a></span></div></div><div class="ni n0"><span class="nh de"><button class="ar icon-button "></button><a href="dropped-features/index.html"><span>Dropped Features</span></a></span><div class="ni n1 "><span class="nh de"><a href="dropped-features/delayed-init.html"><span>Dropped: DelayedInit</span></a></span></div><div class="ni n1 "><span class="nh de"><a href="dropped-features/macros.html"><span>Dropped: Scala 2 Macros</span></a></span></div><div class="ni n1 "><span class="nh de"><a href="dropped-features/existential-types.html"><span>Dropped: Existential Types</span></a></span></div><div class="ni n1 "><span class="nh de"><a href="dropped-features/type-projection.html"><span>Dropped: General Type Projection</span></a></span></div><div class="ni n1 "><span class="nh de"><a href="dropped-features/do-while.html"><span>Dropped: Do-While</span></a></span></div><div class="ni n1 "><span class="nh de"><a href="dropped-features/procedure-syntax.html"><span>Dropped: Procedure Syntax</span></a></span></div><div class="ni n1 "><span class="nh de"><a href="dropped-features/package-objects.html"><span>Dropped: Package Objects</span></a></span></div><div class="ni n1 "><span class="nh de"><a href="dropped-features/early-initializers.html"><span>Dropped: Early Initializers</span></a></span></div><div class="ni n1 "><span class="nh de"><a href="dropped-features/class-shadowing.html"><span>Dropped: Class Shadowing</span></a></span></div><div class="ni n1 "><span class="nh de"><a href="dropped-features/limit22.html"><span>Dropped: Limit 22</span></a></span></div><div class="ni n1 "><span class="nh de"><a href="dropped-features/xml.html"><span>Dropped: XML Literals</span></a></span></div><div class="ni n1 "><span class="nh de"><a href="dropped-features/symlits.html"><span>Dropped: Symbol Literals</span></a></span></div><div class="ni n1 "><span class="nh de"><a href="dropped-features/auto-apply.html"><span>Dropped: Auto-Application</span></a></span></div><div class="ni n1 "><span class="nh de"><a href="dropped-features/weak-conformance.html"><span>Dropped: Weak Conformance</span></a></span></div><div class="ni n1 "><span class="nh de"><a href="dropped-features/nonlocal-returns.html"><span>Deprecated: Nonlocal Returns</span></a></span></div><div class="ni n1 "><span class="nh de"><a href="dropped-features/this-qualifier.html"><span>Dropped: private[this] and protected[this]</span></a></span></div><div class="ni n1 "><span class="nh de"><a href="dropped-features/wildcard-init.html"><span>Dropped: Wildcard Initializer</span></a></span></div></div><div class="ni n0"><span class="nh de"><button class="ar icon-button "></button><a href="experimental/index.html"><span>Experimental</span></a></span><div class="ni n1 "><span class="nh de"><a href="experimental/canthrow.html"><span>CanThrow Capabilities</span></a></span></div><div class="ni n1 "><span class="nh de"><a href="experimental/erased-defs.html"><span>Erased Definitions</span></a></span></div><div class="ni n1 "><span class="nh de"><a href="experimental/named-typeargs.html"><span>Named Type Arguments</span></a></span></div><div class="ni n1 "><span class="nh de"><a href="experimental/numeric-literals.html"><span>Numeric Literals</span></a></span></div><div class="ni n1 "><span class="nh de"><a href="experimental/explicit-nulls.html"><span>Explicit Nulls</span></a></span></div><div class="ni n1 "><span class="nh de"><a href="experimental/main-annotation.html"><span>MainAnnotation</span></a></span></div><div class="ni n1 "><span class="nh de"><a href="experimental/cc.html"><span>Capture Checking</span></a></span></div><div class="ni n1 "><span class="nh de"><a href="experimental/tupled-function.html"><span>Tupled Function</span></a></span></div></div><div class="ni n0 "><span class="nh de"><a href="syntax.html"><span>Scala 3 Syntax Summary</span></a></span></div><div class="ni n0"><span class="nh de"><button class="ar icon-button "></button><a href="language-versions/index.html"><span>Language Versions</span></a></span><div class="ni n1 "><span class="nh de"><a href="language-versions/source-compatibility.html"><span>Source Compatibility</span></a></span></div><div class="ni n1 "><span class="nh de"><a href="language-versions/binary-compatibility.html"><span>Binary Compatibility</span></a></span></div></div><div class="ni n0 "><span class="nh de"><a href="soft-modifier.html"><span>Soft Keywords</span></a></span></div><div class="ni n0 expanded"><span class="nh h100 selected de"><a href="#"><span>A Classification of Proposed Language Features</span></a></span></div></nav></div><div id="footer" class="body-small"><div class="left-container">Generated with</div><div class="right-container"><a href="https://github.com/scala/scala3"><button class="icon-button gh"></button></a><a href="https://discord.com/invite/scala"><button class="icon-button discord"></button></a><a href="https://twitter.com/scala_lang"><button class="icon-button twitter"></button></a><div class="text">Copyright (c) 2002-2025, LAMP/EPFL</div></div><div class="text-mobile">Copyright (c) 2002-2025, LAMP/EPFL</div></div><div id="scaladoc-searchBar"></div><div id="main"><div class="breadcrumbs container"><a href="index.html">Scala 3 Reference</a>/<a href="features-classification.html">A Classification of Proposed Language Features</a></div><div id="content" class="body-medium"><div><div id="content-wrapper">
<div class="site-container">
<div id="site-header"></div>
<main>
<header>
<a class="text-button with-link body-small" href="https://github.com/scala/scala3/edit/language-reference-stable/docs/_docs/reference/features-classification.md">Edit this page on GitHub</a>
<h1 class="h600">A Classification of Proposed Language Features</h1>
</header>
<p class="body-large first-p">This document provides an overview of the constructs proposed for Scala 3 with the aim to facilitate the discussion what to include and when to include it. It classifies features into eight groups: (1) essential foundations, (2) simplifications, (3) restrictions, (4) dropped features, (5) changed features, (6) new features, (7) features oriented towards metaprogramming with the aim to replace existing macros, and (8) changes to type checking and inference.</p>
<p>Each group contains sections classifying the status (i.e. relative importance to be a part of Scala 3, and relative urgency when to decide this) and the migration cost of the constructs in it.</p>
<p>The current document reflects the state of things as of April, 2019. It will be updated to reflect any future changes in that status.</p>
<section id="essential-foundations-3">
<h2 class="h500"><a href="#essential-foundations-3" class="anchor"></a>Essential Foundations</h2>
<p>These new constructs directly model core features of <a href="https://www.scala-lang.org/blog/2016/02/03/essence-of-scala.html">DOT</a>, higher-kinded types, and the <a href="https://infoscience.epfl.ch/record/229878/files/simplicitly_1.pdf">SI calculus for implicit resolution</a>.</p>
<ul>
<li><a href="new-types/intersection-types.html">Intersection types</a>, replacing compound types,</li>
<li><a href="new-types/union-types.html">Union types</a>,</li>
<li><a href="new-types/type-lambdas.html">Type lambdas</a>, replacing encodings using structural types and type projection.</li>
<li><a href="contextual/context-functions.html">Context functions</a> offering abstraction over given parameters.</li>
</ul>
<p><strong>Status: essential</strong></p>
<p>These are essential core features of Scala 3. Without them, Scala 3 would be a completely different language, with different foundations.</p>
<p><strong>Migration cost: none to low</strong></p>
<p>Since these are additions, there's generally no migration cost for old code. An exception are intersection types which replace compound types with slightly cleaned-up semantics. But few programs would be affected by this change.</p>
</section>
<section id="simplifications-3">
<h2 class="h500"><a href="#simplifications-3" class="anchor"></a>Simplifications</h2>
<p>These constructs replace existing constructs with the aim of making the language safer and simpler to use, and to promote uniformity in code style.</p>
<ul>
<li><a href="other-new-features/trait-parameters.html">Trait parameters</a> replace <a href="dropped-features/early-initializers.html">early initializers</a> with a more generally useful construct.</li>
<li><a href="contextual/givens.html">Given instances</a> replace implicit objects and defs, focussing on intent over mechanism.</li>
<li><a href="contextual/using-clauses.html">Using clauses</a> replace implicit parameters, avoiding their ambiguities.</li>
<li><a href="contextual/extension-methods.html">Extension methods</a> replace implicit classes with a clearer and simpler mechanism.</li>
<li><a href="other-new-features/opaques.html">Opaque type aliases</a> replace most uses of value classes while guaranteeing absence of boxing.</li>
<li><a href="dropped-features/package-objects.html">Top-level definitions</a> replace package objects, dropping syntactic boilerplate.</li>
<li><a href="other-new-features/export.html">Export clauses</a> provide a simple and general way to express aggregation, which can replace the previous facade pattern of package objects inheriting from classes.</li>
<li><a href="changed-features/vararg-splices.html">Vararg splices</a> now use the form <code>*</code> instead of <code>@ _*</code>, mirroring vararg expressions,</li>
<li><a href="other-new-features/creator-applications.html">Creator applications</a> allow using simple function call syntax instead of <code>new</code> expressions. <code>new</code> expressions stay around as a fallback for the cases where creator applications cannot be used.</li>
</ul>
<p>With the exception of early initializers and old-style vararg splices, all superseded constructs continue to be available in Scala 3.0. The plan is to deprecate and phase them out later.</p>
<p>Value classes (superseded by opaque type aliases) are a special case. There are currently no deprecation plans for value classes, since we might bring them back in a more general form if they are supported natively by the JVM as is planned by project Valhalla.</p>
<p><strong>Status: bimodal: now or never / can delay</strong></p>
<p>These are essential simplifications. If we decide to adopt them, we should do it for 3.0. Otherwise we are faced with the awkward situation that the Scala 3 documentation has to describe an old feature that will be replaced or superseded by a simpler one in the future.</p>
<p>On the other hand, we need to decide now only about the new features in this list. The decision to drop the superseded features can be delayed. Of course, adopting a new feature without deciding to drop the superseded feature will make the language larger.</p>
<p><strong>Migration cost: moderate</strong></p>
<p>For the next several versions, old features will remain available and deprecation and rewrite techniques can make any migration effort low and gradual.</p>
</section>
<section id="restrictions-3">
<h2 class="h500"><a href="#restrictions-3" class="anchor"></a>Restrictions</h2>
<p>These constructs are restricted to make the language safer.</p>
<ul>
<li><a href="contextual/conversions.html">Implicit Conversions</a>: there is only one way to define implicit conversions instead of many, and potentially surprising implicit conversions require a language import.</li>
<li><a href="contextual/given-imports.html">Given Imports</a>: implicits now require a special form of import, to make the import clearly visible.</li>
<li><a href="dropped-features/type-projection.html">Type Projection</a>: only classes can be used as prefix <code>C</code> of a type projection <code>C#A</code>. Type projection on abstract types is no longer supported since it is unsound.</li>
<li><a href="contextual/multiversal-equality.html">Multiversal equality</a> implements an "opt-in" scheme to rule out nonsensical comparisons with <code>==</code> and <code>!=</code>.</li>
<li><a href="https://github.com/scala/scala3/pull/5975">infix</a> makes method application syntax uniform across code bases.</li>
</ul>
<p>Unrestricted implicit conversions continue to be available in Scala 3.0, but will be deprecated and removed later. Unrestricted versions of the other constructs in the list above are available only under <code>-source 3.0-migration</code>.</p>
<p><strong>Status: now or never</strong></p>
<p>These are essential restrictions. If we decide to adopt them, we should do it for 3.0. Otherwise we are faced with the awkward situation that the Scala 3 documentation has to describe a feature that will be restricted in the future.</p>
<p><strong>Migration cost: low to high</strong></p>
<ul>
<li><em>low</em>: multiversal equality rules out code that is nonsensical, so any rewrites required by its adoption should be classified as bug fixes.</li>
<li><em>moderate</em>: Restrictions to implicits can be accommodated by straightforward rewriting.</li>
<li><em>high</em>: Unrestricted type projection cannot always rewritten directly since it is unsound in general.</li>
</ul>
</section>
<section id="dropped-constructs-3">
<h2 class="h500"><a href="#dropped-constructs-3" class="anchor"></a>Dropped Constructs</h2>
<p>These constructs are proposed to be dropped without a new construct replacing them. The motivation for dropping these constructs is to simplify the language and its implementation.</p>
<ul>
<li><a href="dropped-features/delayed-init.html">DelayedInit</a>,</li>
<li><a href="dropped-features/existential-types.html">Existential types</a>,</li>
<li><a href="dropped-features/procedure-syntax.html">Procedure syntax</a>,</li>
<li><a href="dropped-features/class-shadowing.html">Class shadowing</a>,</li>
<li><a href="dropped-features/xml.html">XML literals</a>,</li>
<li><a href="dropped-features/symlits.html">Symbol literals</a>,</li>
<li><a href="dropped-features/auto-apply.html">Auto application</a>,</li>
<li><a href="dropped-features/weak-conformance.html">Weak conformance</a>,</li>
<li><a href="new-types/intersection-types.html">Compound types</a>,</li>
<li><a href="https://github.com/scala/scala3/pull/4311">Auto tupling</a> (implemented, but not merged).</li>
</ul>
<p>The date when these constructs are dropped varies. The current status is:</p>
<ul>
<li>Not implemented at all:
<ul>
<li>DelayedInit, existential types, weak conformance.</li>
</ul></li>
<li>Supported under <code>-source 3.0-migration</code>:
<ul>
<li>procedure syntax, class shadowing, symbol literals, auto application, auto tupling in a restricted form.</li>
</ul></li>
<li>Supported in 3.0, to be deprecated and phased out later:
<ul>
<li>XML literals, compound types.</li>
</ul></li>
</ul>
<p><strong>Status: mixed</strong></p>
<p>Currently unimplemented features would require considerable implementation effort which would in most cases make the compiler more buggy and fragile and harder to understand. If we do not decide to drop them, they will probably show up as "not yet implemented" in the Scala 3.0 release.</p>
<p>Currently implemented features could stay around indefinitely. Updated docs may simply ignore them, in the expectation that they might go away eventually. So the decision about their removal can be delayed.</p>
<p><strong>Migration cost: moderate to high</strong></p>
<p>Dropped features require rewrites to avoid their use in programs. These rewrites can sometimes be automatic (e.g. for procedure syntax, symbol literals, auto application) and sometimes need to be manual (e.g. class shadowing, auto tupling). Sometimes the rewrites would have to be non-local, affecting use sites as well as definition sites (e.g., in the case of <code>DelayedInit</code>, unless we find a solution).</p>
</section>
<section id="changes-3">
<h2 class="h500"><a href="#changes-3" class="anchor"></a>Changes</h2>
<p>These constructs have undergone changes to make them more regular and useful.</p>
<ul>
<li><a href="changed-features/structural-types.html">Structural Types</a>: They now allow pluggable implementations, which greatly increases their usefulness. Some usage patterns are restricted compared to the status quo.</li>
<li><a href="changed-features/pattern-matching.html">Name-based pattern matching</a>: The existing undocumented Scala 2 implementation has been codified in a slightly simplified form.</li>
<li><a href="changed-features/eta-expansion.html">Eta expansion</a> is now performed universally also in the absence of an expected type. The postfix <code>_</code> operator is thus made redundant. It will be deprecated and dropped after Scala 3.0.</li>
<li><a href="changed-features/implicit-resolution.html">Implicit Resolution</a>: The implicit resolution rules have been cleaned up to make them more useful and less surprising. Implicit scope is restricted to no longer include package prefixes.</li>
</ul>
<p>Most aspects of old-style implicit resolution are still available under <code>-source 3.0-migration</code>. The other changes in this list are applied unconditionally.</p>
<p><strong>Status: strongly advisable</strong></p>
<p>The features have been implemented in their new form in Scala 3.0's compiler. They provide clear improvements in simplicity and functionality compared to the status quo. Going back would require significant implementation effort for a net loss of functionality.</p>
<p><strong>Migration cost: low to high</strong></p>
<p>Only a few programs should require changes, but some necessary changes might be non-local (as in the case of restrictions to implicit scope).</p>
</section>
<section id="new-constructs-3">
<h2 class="h500"><a href="#new-constructs-3" class="anchor"></a>New Constructs</h2>
<p>These are additions to the language that make it more powerful or pleasant to use.</p>
<ul>
<li><a href="enums/enums.html">Enums</a> provide concise syntax for enumerations and <a href="enums/adts.html">algebraic data types</a>.</li>
<li><a href="other-new-features/parameter-untupling.html">Parameter untupling</a> avoids having to use <code>case</code> for tupled parameter destructuring.</li>
<li><a href="new-types/dependent-function-types.html">Dependent function types</a> generalize dependent methods to dependent function values and types.</li>
<li><a href="https://github.com/scala/scala3/pull/4672">Polymorphic function types</a> generalize polymorphic methods to dependent function values and types. <em>Current status</em>: There is a proposal, and a prototype implementation, but the implementation has not been finalized or merged yet.</li>
<li><a href="other-new-features/kind-polymorphism.html">Kind polymorphism</a> allows the definition of operators working equally on types and type constructors.</li>
</ul>
<p><strong>Status: mixed</strong></p>
<p>Enums offer an essential simplification of fundamental use patterns, so they should be adopted for Scala 3.0. Auto-parameter tupling is a very small change that removes some awkwardness, so it might as well be adopted now. The other features constitute more specialized functionality which could be introduced in later versions. On the other hand, except for polymorphic function types they are all fully implemented, so if the Scala 3.0 spec does not include them, they might be still made available under a language flag.</p>
<p><strong>Migration cost: none</strong></p>
<p>Being new features, existing code migrates without changes. To be sure, sometimes it would be attractive to rewrite code to make use of the new features in order to increase clarity and conciseness.</p>
</section>
<section id="metaprogramming-3">
<h2 class="h500"><a href="#metaprogramming-3" class="anchor"></a>Metaprogramming</h2>
<p>The following constructs together aim to put metaprogramming in Scala on a new basis. So far, metaprogramming was achieved by a combination of macros and libraries such as <a href="https://github.com/milessabin/shapeless">Shapeless</a> that were in turn based on some key macros. Current Scala 2 macro mechanisms are a thin veneer on top the current Scala 2 compiler, which makes them fragile and in many cases impossible to port to Scala 3.</p>
<p>It's worth noting that macros were never included in the <a href="https://scala-lang.org/files/archive/spec/2.13/">Scala 2 language specification</a> and were so far made available only under an <code>-experimental</code> flag. This has not prevented their widespread usage.</p>
<p>To enable porting most uses of macros, we are experimenting with the advanced language constructs listed below. These designs are more provisional than the rest of the proposed language constructs for Scala 3.0. There might still be some changes until the final release. Stabilizing the feature set needed for metaprogramming is our first priority.</p>
<ul>
<li><a href="new-types/match-types.html">Match types</a> allow computation on types.</li>
<li><a href="metaprogramming/inline.html">Inline</a> provides by itself a straightforward implementation of some simple macros and is at the same time an essential building block for the implementation of complex macros.</li>
<li><a href="metaprogramming/macros.html">Quotes and splices</a> provide a principled way to express macros and staging with a unified set of abstractions.</li>
<li><a href="contextual/derivation.html">Type class derivation</a> provides an in-language implementation of the <code>Gen</code> macro in Shapeless and other foundational libraries. The new implementation is more robust, efficient and easier to use than the macro.</li>
<li><a href="contextual/by-name-context-parameters.html">Implicit by-name parameters</a> provide a more robust in-language implementation of the <code>Lazy</code> macro in Shapeless.</li>
</ul>
<p><strong>Status: not yet settled</strong></p>
<p>We know we need a practical replacement for current macros. The features listed above are very promising in that respect, but we need more complete implementations and more use cases to reach a final verdict.</p>
<p><strong>Migration cost: very high</strong></p>
<p>Existing macro libraries will have to be rewritten from the ground up. In many cases the rewritten libraries will turn out to be simpler and more robust than the old ones, but that does not relieve one of the cost of the rewrites. It's currently unclear to what degree users of macro libraries will be affected. We aim to provide sufficient functionality so that core macros can be re-implemented fully, but given the vast feature set of the various macro extensions to Scala 2 it is difficult to arrive at a workable limitation of scope.</p>
</section>
<section id="changes-to-type-checking-and-inference-1">
<h2 class="h500"><a href="#changes-to-type-checking-and-inference-1" class="anchor"></a>Changes to Type Checking and Inference</h2>
<p>The Scala 3 compiler uses a new algorithm for type inference, which relies on a general subtype constraint solver. The new algorithm often <a href="https://contributors.scala-lang.org/t/better-type-inference-for-scala-send-us-your-problematic-cases/2410">works better than the old</a>, but there are inevitably situations where the results of both algorithms differ, leading to errors diagnosed by Scala 3 for programs that the Scala 2 compiler accepts.</p>
<p><strong>Status: essential</strong></p>
<p>The new type-checking and inference algorithms are the essential core of the new compiler. They cannot be reverted without dropping the whole implementation of Scala 3.</p>
<p><strong>Migration cost: high</strong></p>
<p>Some existing programs will break and, given the complex nature of type inference, it will not always be clear what change caused the breakage and how to fix it.</p>
<p>In our experience, macros and changes in type and implicit argument inference together cause the large majority of problems encountered when porting existing code to Scala 3. The latter source of problems could be addressed systematically by a tool that added all inferred types and implicit arguments to a Scala 2 source code file. Most likely such a tool would be implemented as a <a href="https://docs.scala-lang.org/overviews/plugins/index.html">Scala 2 compiler plugin</a>. The resulting code would have a greatly increased likelihood to compile under Scala 3, but would often be bulky to the point of being unreadable. A second part of the rewriting tool should then selectively and iteratively remove type and implicit annotations that were synthesized by the first part as long as they compile under Scala 3. This second part could be implemented as a program that invokes the Scala 3 compiler <code>scalac</code> programmatically.</p>
<p>Several people have proposed such a tool for some time now. I believe it is time we find the will and the resources to actually implement it.</p>
</section>
</main>
<div class="divider"></div>
<nav class="arrow-navigation" aria-label="Page navigation">
<div>
<span class="body-small">Previous</span> <a rel="prev" href="soft-modifier.html" aria-keyshortcuts="Left" class="body-medium"> <span class="body-medium">Soft Keywords</span> </a>
</div>
</nav>
</div>
</div></div><div id="toc" class="body-small"><div id="toc-container"><span class="toc-title h200">In this article</span><nav class="toc-nav"><ul class="toc-list"><li><a href="#essential-foundations-3">Essential Foundations</a></li><li><a href="#simplifications-3">Simplifications</a></li><li><a href="#restrictions-3">Restrictions</a></li><li><a href="#dropped-constructs-3">Dropped Constructs</a></li><li><a href="#changes-3">Changes</a></li><li><a href="#new-constructs-3">New Constructs</a></li><li><a href="#metaprogramming-3">Metaprogramming</a></li><li><a href="#changes-to-type-checking-and-inference-1">Changes to Type Checking and Inference</a></li></ul></nav></div></div></div><div id="footer" class="body-small mobile-footer"><div class="left-container">Generated with</div><div class="right-container"><a href="https://github.com/scala/scala3"><button class="icon-button gh"></button></a><a href="https://discord.com/invite/scala"><button class="icon-button discord"></button></a><a href="https://twitter.com/scala_lang"><button class="icon-button twitter"></button></a><div class="text">Copyright (c) 2002-2025, LAMP/EPFL</div></div><div class="text-mobile">Copyright (c) 2002-2025, LAMP/EPFL</div></div></div></div></body></html>