Skip to content

Commit aa81657

Browse files
authored
Merge pull request #6251 from dotty-staging/add-export-index
Update Reference Docs
2 parents a005e29 + 48a2e03 commit aa81657

File tree

8 files changed

+284
-143
lines changed

8 files changed

+284
-143
lines changed

docs/docs/reference/features-classification.md

Lines changed: 31 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
---
22
layout: doc-page
33
title: A Classification of Proposed Language Features
4-
date: February 28, 2019
4+
date: April 6, 2019
55
author: Martin Odersky
66
---
77

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.
99

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.
1212

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.
1414

1515
## Essential Foundations
1616

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).
1818

1919
- [Intersection types](https://dotty.epfl.ch/docs/reference/new-types/intersection-types.html), replacing compound types,
2020
- [Union types](https://dotty.epfl.ch/docs/reference/new-types/union-types.html),
2121
- [Type lambdas](https://dotty.epfl.ch/docs/reference/new-types/type-lambdas.html),
2222
replacing encodings using structural types and type projection.
2323
- [Context Queries](https://dotty.epfl.ch/docs/reference/contextual/query-types.html)
24-
(aka implicit function types) offering abstraction over inferable parameters.
24+
(_aka_ implicit function types) offering abstraction over inferable parameters.
2525

2626
**Status: essential**
2727

@@ -33,22 +33,25 @@ Since these are additions, there's generally no migration cost for old code. An
3333

3434
## Simplifications
3535

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.
3737

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.
3939
- [Implied Instances](https://dotty.epfl.ch/docs/reference/contextual/instance-defs.html)
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,
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.
4343
- [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,
45-
- [Toplevel definitions](https://dotty.epfl.ch/docs/reference/dropped-features/package-objects.html) replace package objects, dropping syntactic boilerplate,
44+
of value classes while guaranteeing absence of boxing.
45+
- [Toplevel definitions](https://dotty.epfl.ch/docs/reference/dropped-features/package-objects.html) replace package objects, dropping syntactic boilerplate.
46+
- [Export clauses](https://dotty.epfl.ch/docs/reference/new-features/export.html)
47+
provide a simple and general way to express aggregation, which can replace the
48+
previous facade pattern of package objects inheriting from classes.
4649
- [Vararg patterns](https://dotty.epfl.ch/docs/reference/changed-features/vararg-patterns.html) now use the form `: _*` instead of `@ _*`, mirroring vararg expressions,
4750
- [Creator applications](https://dotty.epfl.ch/docs/reference/other-new-features/creator-applications.html) allow to use simple function call syntax
4851
instead of `new` expressions. `new` expressions stay around as a fallback for
4952
the cases where creator applications cannot be used.
5053

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.
5255

5356
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.
5457

@@ -65,7 +68,7 @@ For the next several versions, old features will remain available and deprecatio
6568

6669
## Restrictions
6770

68-
These features are restricted to make the language safer.
71+
These constructs are restricted to make the language safer.
6972

7073
- [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.
7174
- [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.
7477
- [@infix and @alpha](https://github.com/lampepfl/dotty/pull/5975)
7578
make method application syntax uniform across code bases and require alphanumeric aliases for all symbolic names (proposed, not implemented).
7679

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`.
7881

7982
**Status: now or never**
8083

@@ -86,9 +89,9 @@ These are essential restrictions. If we decide to adopt them, we should do it fo
8689
- _moderate_: Restrictions to implicits can be accommodated by straightforward rewriting.
8790
- _high_: Unrestricted type projection cannot always rewritten directly since it is unsound in general.
8891

89-
## Dropped Features
92+
## Dropped Constructs
9093

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.
9295

9396
- [DelayedInit](https://dotty.epfl.ch/docs/reference/dropped-features/delayed-init.html),
9497
- [Existential types](https://dotty.epfl.ch/docs/reference/dropped-features/existential-types.html),
@@ -101,7 +104,7 @@ These features are proposed to be dropped without a new feature replacing them.
101104
- [Compound types](https://dotty.epfl.ch/docs/reference/new-types/intersection-types.html),
102105
- [Auto tupling](https://github.com/lampepfl/dotty/pull/4311) (implemented, but not merged).
103106

104-
The date when these features are dropped varies. The current status is:
107+
The date when these constructs are dropped varies. The current status is:
105108

106109
- Not implemented at all:
107110
- DelayedInit, existential types, weak conformance.
@@ -123,7 +126,7 @@ and sometimes need to be manual (e.g. class shadowing, auto tupling). Sometimes
123126

124127
## Changes
125128

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.
127130

128131
- [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.
129132
- [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
140143

141144
Only a few programs should require changes, but some necessary changes might be non-local (as in the case of restrictions to implicit scope).
142145

143-
## New Features
146+
## New Constructs
144147

145148
These are additions to the language that make it more powerful or pleasant to use.
146149

147150
- [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.
151152
- [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.
153154
- [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.
154155

155156
**Status: mixed**
@@ -162,18 +163,18 @@ Being new features, existing code migrates without changes. To be sure, sometime
162163

163164
## Meta Programming
164165

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.
166167

167168
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.
168169

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.
170171

171172
- [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.
174173
- [Inline](https://dotty.epfl.ch/docs/reference/other-new-features/inline.html) provides
175174
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.
176175
- [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.
177178
- [Erased Terms](https://dotty.epfl.ch/docs/reference/other-new-features/erased-terms.html) provide a general mechanism for compile-time-only computations.
178179

179180
**Status: not yet settled**

docs/docs/reference/other-new-features/export.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
layout: doc-page
3-
title: "Export"
3+
title: "Export Clauses"
44
---
55

66
An export clause defines aliases for selected members of an object. Example:

docs/docs/reference/other-new-features/named-typeargs.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ layout: doc-page
33
title: "Named Type Arguments"
44
---
55

6+
**Note:** This feature is implemented in Dotty, but is not expected to be part of Scala 3.0.
7+
68
Type arguments of methods can now be named, as well as by position. Example:
79

810
``` scala

docs/docs/reference/other-new-features/auto-parameter-tupling-spec.md renamed to docs/docs/reference/other-new-features/parameter-untupling-spec.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
layout: doc-page
3-
title: "Automatic Tupling of Function Parameters - More Details"
3+
title: "Parameter Untupling - More Details"
44
---
55

66
### Motivation
@@ -11,7 +11,7 @@ Say you have a list of pairs
1111
val xs: List[(Int, Int)]
1212
```
1313

14-
and you want to map `xs` to a list of `Int`s so that each pair of numbers is mapped to their sum.
14+
and you want to map `xs` to a list of `Int`s so that each pair of numbers is mapped to their sum.
1515
Previously, the best way to do this was with a pattern-matching decomposition:
1616
```scala
1717
xs.map {
@@ -50,7 +50,7 @@ can in turn be adapted to the expected type with auto-tupling.
5050

5151
#### Term addaptation
5252

53-
If the a function
53+
If the a function
5454
```scala
5555
(p1: T1, ..., pn: Tn) => e
5656
```
@@ -76,7 +76,7 @@ Translation of such a tuples would use the `apply` method on the tuple to access
7676
Code like this could not be written before, hence the new notation would not be ambigouous after adoption.
7777

7878
Though it is possible that someone has written an implicit conversion form `(T1, ..., Tn) => R` to `TupleN[T1, ..., Tn] => R`
79-
for some `n`. This change could be detected and fixed by `Scalafix`. Furthermore, such conversion would probably
79+
for some `n`. This change could be detected and fixed by `Scalafix`. Furthermore, such conversion would probably
8080
be doing the same translation (semantically) but in a less efficient way.
8181

8282
### Reference

docs/docs/reference/other-new-features/auto-parameter-tupling.md renamed to docs/docs/reference/other-new-features/parameter-untupling.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
layout: doc-page
3-
title: "Automatic Tupling of Function Parameters"
3+
title: "Parameter Untupling"
44
---
55

66
Say you have a list of pairs
@@ -31,5 +31,5 @@ function type of the form `((T_1, ..., T_n)) => U`.
3131
### Reference
3232

3333
For more info see:
34-
* [More details](./auto-parameter-tupling-spec.html)
34+
* [More details](./parameter-untupling-spec.html)
3535
* [Issue #897](https://github.com/lampepfl/dotty/issues/897).

0 commit comments

Comments
 (0)