You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Tame powerful constructs such as implicits to provide a gentler learning curve. Remove warts and puzzlers.
18
+
- Further improve the consistency and expressiveness of Scala's language constructs.
18
19
19
20
Corresponding to these goals, the language changes fall into seven categories:
20
21
(1) Core constructs to strengthen foundations, (2) simplifications and (3) [restrictions](#restrictions), to make the language easier and safer to use, (4) dropped constructs to make the language smaller and more regular, (5) [changed constructs](#changes) to remove warts, and increase consistency and usability, (6) [new constructs](#new-constructs) to fill gaps and increase expressiveness, (7) a new, principled approach to metaprogramming that replaces [Scala 2 experimental macros](https://docs.scala-lang.org/overviews/macros/overview.html).
@@ -23,30 +24,35 @@ Corresponding to these goals, the language changes fall into seven categories:
23
24
24
25
These new constructs directly model core features of DOT, higher-kinded types, and the [SI calculus for implicit resolution](https://infoscience.epfl.ch/record/229878/files/simplicitly_1.pdf).
-[Type lambdas](new-types/type-lambdas.md), replacing encodings using structural types and type projection.
30
+
-[Context functions](contextual/context-functions.md), offering abstraction over given parameters.
30
31
31
32
## Simplifications
32
33
33
34
These constructs replace existing constructs with the aim of making the language safer and simpler to use, and to promote uniformity in code style.
34
35
35
-
-[Trait parameters](other-new-features/trait-parameters.md) replace [early initializers](dropped-features/early-initializers.md) with a more generally useful construct.
36
-
-[Given instances](contextual/givens.md)
37
-
replace implicit objects and defs, focussing on intent over mechanism.
38
-
-[Using clauses](contextual/using-clauses.md) replace implicit parameters, avoiding their ambiguities.
39
-
-[Extension methods](contextual/extension-methods.md) replace implicit classes with a clearer and simpler mechanism.
40
-
-[Opaque type aliases](other-new-features/opaques.md) replace most uses
41
-
of value classes while guaranteeing absence of boxing.
allow using simple function call syntax instead of `new` expressions. `new` expressions stay around
55
+
as a fallback for the cases where creator applications cannot be used.
50
56
51
57
With the exception of [early initializers](dropped-features/early-initializers.md) and old-style vararg patterns, all superseded constructs continue to be available in Scala 3.0. The plan is to deprecate and phase them out later.
52
58
@@ -56,62 +62,69 @@ Value classes (superseded by opaque type aliases) are a special case. There are
56
62
57
63
These constructs are restricted to make the language safer.
58
64
59
-
-[Implicit Conversions](contextual/conversions.md): there is only one way to define implicit conversions instead of many, and potentially surprising implicit conversions require a language import.
60
-
-[Given Imports](contextual/given-imports.md): implicits now require a special form of import, to make the import clearly visible.
61
-
-[Type Projection](dropped-features/type-projection.md): only classes can be used as prefix `C` of a type projection `C#A`. Type projection on abstract types is no longer supported since it is unsound.
62
-
-[Multiversal Equality](contextual/multiversal-equality.md) implements an "opt-in" scheme to rule out nonsensical comparisons with `==` and `!=`.
63
-
-[infix](changed-features/operators.md)
64
-
make method application syntax uniform across code bases.
implement an "opt-in" scheme to rule out nonsensical comparisons with `==` and `!=`.
73
+
-[infix](changed-features/operators.md):
74
+
make method application syntax uniform across code bases.
65
75
66
76
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 `-source 3.0-migration`.
67
77
68
-
69
78
## Dropped Constructs
70
79
71
80
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.
These constructs have undergone changes to make them more regular and useful.
97
105
98
-
-[Structural Types](changed-features/structural-types.md): They now allow pluggable implementations, which greatly increases their usefulness. Some usage patterns are restricted compared to the status quo.
99
-
-[Name-based pattern matching](changed-features/pattern-matching.md): The existing undocumented Scala 2 implementation has been codified in a slightly simplified form.
100
-
-[Eta expansion](changed-features/eta-expansion.md) is now performed universally also in the absence of an expected type. The postfix `_` operator is thus made redundant. It will be deprecated and dropped after Scala 3.0.
101
-
-[Implicit Resolution](changed-features/implicit-resolution.md): 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.
The existing undocumented Scala 2 implementation has been codified in a slightly simplified form.
110
+
-[Automatic Eta expansion](changed-features/eta-expansion.md):
111
+
Eta expansion is now performed universally also in the absence of an expected type. The postfix `_` operator is thus made redundant. It will be deprecated and dropped after Scala 3.0.
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.
102
114
103
115
Most aspects of old-style implicit resolution are still available under `-source 3.0-migration`. The other changes in this list are applied unconditionally.
104
116
105
117
## New Constructs
106
118
107
119
These are additions to the language that make it more powerful or pleasant to use.
108
120
109
-
-[Enums](enums/enums.md) provide concise syntax for enumerations and [algebraic data types](enums/adts.md).
110
-
-[Parameter untupling](other-new-features/parameter-untupling.md) avoids having to use `case` for tupled parameter destructuring.
111
-
-[Dependent function types](new-types/dependent-function-types.md) generalize dependent methods to dependent function values and types.
112
-
-[Polymorphic function types](new-types/polymorphic-function-types.md) generalize polymorphic methods to polymorphic function values and types. _Current status_: There is a proposal and a merged prototype implementation, but the implementation has not been finalized (it is notably missing type inference support).
113
-
-[Kind polymorphism](other-new-features/kind-polymorphism.md) allows the definition of operators working equally on types and type constructors.
114
-
-[`@targetName` annotations](other-new-features/targetName.md) make it easier to interoperate with code written in other languages and give more flexibility for avoiding name clashes.
121
+
-[Enums](enums/enums.md) provide concise syntax for enumerations and [algebraic data types](enums/adts.md).
122
+
-[Parameter untupling](other-new-features/parameter-untupling.md) avoids having to use `case` for tupled parameter destructuring.
123
+
-[Dependent function types](new-types/dependent-function-types.md) generalize dependent methods to dependent function values and types.
124
+
-[Polymorphic function types](new-types/polymorphic-function-types.md) generalize polymorphic methods to polymorphic function values and types.
125
+
_Current status_: There is a proposal and a merged prototype implementation, but the implementation has not been finalized (it is notably missing type inference support).
126
+
-[Kind polymorphism](other-new-features/kind-polymorphism.md) allows the definition of operators working equally on types and type constructors.
127
+
-[`@targetName` annotations](other-new-features/targetName.md) make it easier to interoperate with code written in other languages and give more flexibility for avoiding name clashes.
115
128
116
129
## Metaprogramming
117
130
@@ -121,12 +134,16 @@ It's worth noting that macros were never included in the [Scala 2 language speci
121
134
122
135
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.
123
136
124
-
-[Match Types](new-types/match-types.md) allow computation on types.
125
-
-[Inline](metaprogramming/inline.md) provides
126
-
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.
127
-
-[Quotes and Splices](metaprogramming/macros.md) provide a principled way to express macros and staging with a unified set of abstractions.
128
-
-[Type class derivation](contextual/derivation.md) provides an in-language implementation of the `Gen` macro in Shapeless and other foundational libraries. The new implementation is more robust, efficient and easier to use than the macro.
129
-
-[Implicit by-name parameters](contextual/by-name-context-parameters.md) provide a more robust in-language implementation of the `Lazy` macro in [Shapeless](https://github.com/milessabin/shapeless).
137
+
-[Match Types](new-types/match-types.md)
138
+
allow computation on types.
139
+
-[Inline](metaprogramming/inline.md)
140
+
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.
141
+
-[Quotes and Splices](metaprogramming/macros.md)
142
+
provide a principled way to express macros and staging with a unified set of abstractions.
143
+
-[Type class derivation](contextual/derivation.md)
144
+
provides an in-language implementation of the `Gen` macro in Shapeless and other foundational libraries. The new implementation is more robust, efficient and easier to use than the macro.
0 commit comments