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
Copy file name to clipboardExpand all lines: docs/docs/reference/features-classification.md
+31-30Lines changed: 31 additions & 30 deletions
Original file line number
Diff line number
Diff line change
@@ -1,27 +1,27 @@
1
1
---
2
2
layout: doc-page
3
3
title: A Classification of Proposed Language Features
4
-
date: February 28, 2019
4
+
date: April 6, 2019
5
5
author: Martin Odersky
6
6
---
7
7
8
-
This document provides an overview of the features 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 meta-programming with the aim to replace existing macros, and (8) changes to type checking and inference.
8
+
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 meta-programming with the aim to replace existing macros, and (8) changes to type checking and inference.
9
9
10
-
Each feature 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
11
-
of the features in it.
10
+
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
11
+
of the constructs in it.
12
12
13
-
The current document reflects the state of things as of end of February, 2019. It will be updated to reflect any future changes in that status.
13
+
The current document reflects the state of things as of April, 2019. It will be updated to reflect any future changes in that status.
14
14
15
15
## Essential Foundations
16
16
17
-
These new features 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).
17
+
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).
(aka implicit function types) offering abstraction over inferable parameters.
24
+
(_aka_ implicit function types) offering abstraction over inferable parameters.
25
25
26
26
**Status: essential**
27
27
@@ -33,22 +33,25 @@ Since these are additions, there's generally no migration cost for old code. An
33
33
34
34
## Simplifications
35
35
36
-
These features replace existing constructs with the aim of making the language safer and simpler to use, and to promote uniformity in code style.
36
+
These constructs replace existing constructs with the aim of making the language safer and simpler to use, and to promote uniformity in code style.
37
37
38
-
-[Trait Parameters](https://dotty.epfl.ch/docs/reference/other-new-features/trait-parameters.html) replace [early initializers](https://dotty.epfl.ch/docs/reference/dropped-features/early-initializers.html) with a more generally useful construct,
38
+
-[Trait Parameters](https://dotty.epfl.ch/docs/reference/other-new-features/trait-parameters.html) replace [early initializers](https://dotty.epfl.ch/docs/reference/dropped-features/early-initializers.html) with a more generally useful construct.
replace implicit objects and defs, focussing on intent over mechanism,
41
-
-[Inferable parameters](https://dotty.epfl.ch/docs/reference/contextual/inferable-params.html) replace implicit parameters, avoiding their ambiguities,
42
-
-[Extension Methods](https://dotty.epfl.ch/docs/reference/contextual/extension-methods.html) replace implicit classes with a clearer and simpler mechanism,
40
+
replace implicit objects and defs, focussing on intent over mechanism.
41
+
-[Inferable parameters](https://dotty.epfl.ch/docs/reference/contextual/inferable-params.html) replace implicit parameters, avoiding their ambiguities.
42
+
-[Extension Methods](https://dotty.epfl.ch/docs/reference/contextual/extension-methods.html) replace implicit classes with a clearer and simpler mechanism.
43
43
-[Opaque Type Aliases](https://dotty.epfl.ch/docs/reference/other-new-features/opaques.html) replace most uses
44
-
of value classes while guaranteeing absence of boxing,
provide a simple and general way to express aggregation, which can replace the
48
+
previous facade pattern of package objects inheriting from classes.
46
49
-[Vararg patterns](https://dotty.epfl.ch/docs/reference/changed-features/vararg-patterns.html) now use the form `: _*` instead of `@ _*`, mirroring vararg expressions,
47
50
-[Creator applications](https://dotty.epfl.ch/docs/reference/other-new-features/creator-applications.html) allow to use simple function call syntax
48
51
instead of `new` expressions. `new` expressions stay around as a fallback for
49
52
the cases where creator applications cannot be used.
50
53
51
-
With the exception of early initializers and old-style vararg patterns, all superseded features continue to be available in Scala 3.0. The plan is to deprecate and phase them out later.
54
+
With the exception of early initializers 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
55
53
56
Value classes (superseded by opaque type aliases) are a special case. There are currently no deprecation plans for value classes, since we might want to bring them back in a more general form if they are supported natively by the JVM as is planned by project Valhalla.
54
57
@@ -65,7 +68,7 @@ For the next several versions, old features will remain available and deprecatio
65
68
66
69
## Restrictions
67
70
68
-
These features are restricted to make the language safer.
71
+
These constructs are restricted to make the language safer.
69
72
70
73
-[Implicit Conversions](https://dotty.epfl.ch/docs/reference/contextual/conversions.html): there is only one way to define implicit conversions instead of many, and potentially surprising implicit conversions require a language import.
71
74
-[Implied Imports](https://dotty.epfl.ch/docs/reference/contextual/import-implied.html): implicits now require a special form of import, to make the import clearly visible.
@@ -74,7 +77,7 @@ These features are restricted to make the language safer.
74
77
-[@infix and @alpha](https://github.com/lampepfl/dotty/pull/5975)
75
78
make method application syntax uniform across code bases and require alphanumeric aliases for all symbolic names (proposed, not implemented).
76
79
77
-
Unrestricted implicit conversions continue to be available in Scala 3.0, but will be deprecated and removed later. Unrestricted versions of the other features in the list above are available only under `-language:Scala2`.
80
+
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 `-language:Scala2`.
78
81
79
82
**Status: now or never**
80
83
@@ -86,9 +89,9 @@ These are essential restrictions. If we decide to adopt them, we should do it fo
86
89
-_moderate_: Restrictions to implicits can be accommodated by straightforward rewriting.
87
90
-_high_: Unrestricted type projection cannot always rewritten directly since it is unsound in general.
88
91
89
-
## Dropped Features
92
+
## Dropped Constructs
90
93
91
-
These features are proposed to be dropped without a new feature replacing them. The motivation for dropping these features is to simplify the language and its implementation.
94
+
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.
@@ -123,7 +126,7 @@ and sometimes need to be manual (e.g. class shadowing, auto tupling). Sometimes
123
126
124
127
## Changes
125
128
126
-
These features have undergone changes in Scala 3 to make them more regular and useful.
129
+
These constructs have undergone changes to make them more regular and useful.
127
130
128
131
-[Structural Types](https://dotty.epfl.ch/docs/reference/changed-features/structural-types.html): They now allow pluggable implementations, which greatly increases their usefulness. Some usage patterns are restricted compared to the status quo.
129
132
-[Name-based pattern matching](https://dotty.epfl.ch/docs/reference/changed-features/pattern-matching.html): The existing undocumented Scala 2 implementation has been codified in a slightly simplified form.
@@ -140,16 +143,14 @@ The features have been implemented in their new form in Scala 3.0's compiler. Th
140
143
141
144
Only a few programs should require changes, but some necessary changes might be non-local (as in the case of restrictions to implicit scope).
142
145
143
-
## New Features
146
+
## New Constructs
144
147
145
148
These are additions to the language that make it more powerful or pleasant to use.
146
149
147
150
-[Enums](https://dotty.epfl.ch/docs/reference/enums/enums.html) provide concise syntax for enumerations and [algebraic data types](https://dotty.epfl.ch/docs/reference/enums/adts.html).
148
-
-[Auto Parameter Tupling](https://dotty.epfl.ch/docs/reference/other-new-features/auto-parameter-tupling.html) avoid having to use `case` for tupled parameter destructuring.
149
-
-[Named Type Arguments](https://dotty.epfl.ch/docs/reference/other-new-features/named-typeargs.html) generalize named parameters, providing the ability to define
150
-
a partial list of type arguments.
151
+
-[Parameter Untupling](https://dotty.epfl.ch/docs/reference/other-new-features/parameter-untupling.html) avoids having to use `case` for tupled parameter destructuring.
151
152
-[Dependent Function Types](https://dotty.epfl.ch/docs/reference/new-types/dependent-function-types.html) generalize dependent methods to dependent function values and types.
152
-
-[Polymorphic Function Types](https://github.com/lampepfl/dotty/pull/4672) generalize polymorphic methods to dependent function values and types (proposed, not fully implemented).
153
+
-[Polymorphic Function Types](https://github.com/lampepfl/dotty/pull/4672) generalize polymorphic methods to dependent function values and types. _Current status_: There is a proposal, and a prototype implementation, but the implementation has not been finalized or merged yet.
153
154
-[Kind Polymorphism](https://dotty.epfl.ch/docs/reference/other-new-features/kind-polymorphism.html) allows the definition of operators working equally on types and type constructors.
154
155
155
156
**Status: mixed**
@@ -162,18 +163,18 @@ Being new features, existing code migrates without changes. To be sure, sometime
162
163
163
164
## Meta Programming
164
165
165
-
The following features together try to put meta programming in Scala on a new basis. So far, meta programming was achieved by a combination of macros and libraries such as Shapeless 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.
166
+
The following constructs together aim to put meta programming in Scala on a new basis. So far, meta programming was achieved by a combination of macros and libraries such as Shapeless 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.
166
167
167
168
It's worth noting that macros were never included in the Scala 2 language specification and were so far made available only under an `-experimental` flag. This has not prevented their widespread usage.
168
169
169
-
To enable porting most uses of macros, we propose the advanced language features listed below. These designs are more provisional than the rest of the proposed language features for Scala 3.0. There might still be some changes until the final release. Stabilizing the feature set needed for meta programming is our first priority.
170
+
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 meta programming is our first priority.
170
171
171
172
-[Match Types](https://dotty.epfl.ch/docs/reference/new-types/match-types.html) allow computation on types.
172
-
-[Typeclass derivation](https://dotty.epfl.ch/docs/reference/contextual/derivation.html) 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.
173
-
-[Inferable by-name parameters](https://dotty.epfl.ch/docs/reference/contextual/inferable-by-name-parameters.html) provide a more robust in-language implementation of the `Lazy` macro in Shapeless.
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.
176
175
-[Quotes and Splices](https://dotty.epfl.ch/docs/reference/other-new-features/principled-meta-programming.html) provide a principled way to express macros and staging with a unified set of abstractions.
176
+
-[Typeclass derivation](https://dotty.epfl.ch/docs/reference/contextual/derivation.html) 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.
177
+
-[Implicit by-name parameters](https://dotty.epfl.ch/docs/reference/contextual/inferable-by-name-parameters.html) provide a more robust in-language implementation of the `Lazy` macro in Shapeless.
177
178
-[Erased Terms](https://dotty.epfl.ch/docs/reference/other-new-features/erased-terms.html) provide a general mechanism for compile-time-only computations.
0 commit comments