Skip to content

Commit a0efa9d

Browse files
committed
Fix typos and add links to overview
Update sidebar.yml. Literal singleton types are dropped here since they are already in Scala 13.
1 parent 70f81fc commit a0efa9d

File tree

2 files changed

+28
-25
lines changed

2 files changed

+28
-25
lines changed

docs/docs/reference/overview.md

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ The new features all address one or more of four major concerns:
1212
- [Performance](performance)
1313

1414
Scala 3 also drops a number of features that were used rarely, or where experience showed
15-
that they tended to cause problems in codebases. These are [listed in a separate section](./dropped).
15+
that they tended to cause problems in codebases. These are listed separately in the [Dropped Features](http://dotty.epfl.ch/docs) section.
1616

1717
Not included in this overview are changes to meta programming and generic programming. So far these have relied on a macro system that had experimental status (`scala.reflect` macros. This macro system will be replaced with a different solution. The current state of the design will be described elsewhere.
1818

@@ -21,52 +21,57 @@ Not included in this overview are changes to meta programming and generic progra
2121

2222
Constructs that make the language more consistent internally, and consistent with its foundations. Constructs that admit useful laws of reasoning.
2323

24-
- Intersection type `A & B`
24+
- [Intersection types](http://dotty.epfl.ch/docs/reference/intersection-types.html) `A & B`
2525

2626
Replaces compound type `A with B` (the old syntax is kept for the moment but will
2727
be deprecated in the future). Intersection types are one of the core features of DOT. They
2828
are commutative: `A & B` and `B & A` represent the same type.
2929

30-
- Implicit function type `implicit A => B`.
30+
- [Implicit function types(http://dotty.epfl.ch/docs/reference/implicit-function-types.html) `implicit A => B`.
3131

3232
Methods and lambdas can have implicit parameters, so it's natural to extend the
33-
same property to function types. Implicit function types help ergonomics nnd performance
33+
same property to function types. Implicit function types help ergonomics and performance
3434
as well. They can replace many uses of monads at an order of magnitude improvement
3535
in runtime speed, and with far better composability.
3636

37-
- Dependent function type `(x: T) => x.S`.
37+
- [Dependent function types](http://dotty.epfl.ch/docs/reference/dependent-function-types.html) `(x: T) => x.S`.
3838

39-
The result type of a method can refer to its parmeters. We now extend the same capability
39+
The result type of a method can refer to its parameters. We now extend the same capability
4040
to the result type of a function.
4141

42-
- Type lambda `[X] => C[X]`
42+
- [Trait parameters](http://dotty.epfl.ch/docs/reference/trait-parameters.html) `trait T(x: S)`
43+
44+
Trait can now have value parameters, just like classes do. This replaces the cumbersome
45+
[early initializer](http://dotty.epfl.ch/docs/reference/dropped/early-initializers.html) syntax.
46+
47+
- [Type lambdas](http://dotty.epfl.ch/docs/reference/type-lambdas.html) `[X] => C[X]`
4348

4449
Type lambdas were encoded previously in an extremely roundabout way, exploiting
4550
loopholes in Scala's type system which made it Turing complete and unsound. With
4651
the removal of unrestricted type projection the loopholes are eliminated, so the
4752
previous encodings are no longer expressible. Type lambdas in the language provide
48-
a safe andmore ergonimic alternative.
53+
a safe and more ergonomic alternative.
4954

5055
<a name="safety"></a>
5156
## Safety
5257

53-
Constructs that help precise, typecheched domain modeling and that improve the
58+
Constructs that help precise, typechecked domain modeling and that improve the
5459
reliability of refactorings.
5560

56-
- Union types `A | B`
61+
- [Union types](http://dotty.epfl.ch/docs/reference/union-types.html) `A | B`
5762

5863
Union types gives fine-grained control over the possible values of a type.
5964
A union type `A | B` states that a value can be an `A` or a `B` without having
6065
to widen to a common supertype of `A` and `B`. Union types thus enable more
6166
precise domain modeling. They are also very useful for interoperating with
6267
Javascript libraries and JSON protocols.
6368

64-
- Multiversal Equality
69+
- [Multiversal Equality](http://dotty.epfl.ch/docs/reference/multiversal-equality.html)
6570

6671
Multiversal equality is an opt in way to check that comparisons using `==` and
6772
`!=` only apply to compatible types. It thus closes the biggest remaining hurdle
6873
to type-based refactoring. Normally, one would wish that one could change the type
69-
of some value or operation in a large codebase, fix all type errors, and obtain
74+
of some value or operation in a large code base, fix all type errors, and obtain
7075
at the end a working program. But universal equality `==` works for all types.
7176
So what should conceptually be a type error would not be reported and
7277
runtime behavior would change instead. Multiversal equality closes that loophole.
@@ -88,47 +93,45 @@ reliability of refactorings.
8893
will be defined by the language, others can be added by libraries. Initially, the language
8994
will likely only cover exceptions as effect capabilities, but it can be extended later
9095
to mutations and possibly other effects. To ensure backwards compatibility, all effect
91-
capabilities are initially available in `Predef`. Unimporting effect capabilities from
96+
capabilities are initially available in `Predef`. Un-importing effect capabilities from
9297
`Predef` will enable stricter effect checking, and provide stronger guarantees of purity.
9398

9499
<a name="ergonomics"></a>
95100
## Ergonomics
96101

97102
Constructs that make common programming patterns more concise and readable.
98103

99-
- Enums `enum Color { case Red, Green, Blue }`
104+
- [Enums](http://dotty.epfl.ch/docs/reference/enums/enums.html) `enum Color { case Red, Green, Blue }`
100105

101106
Enums give a simple way to express a type with a finite set of named values. They
102107
are found in most languages. The previous encodings of enums in Scala were all had
103108
problems that prevented universal adoption. The new native `enum` construct in Scala
104-
is quite flexile; among others it gives a more concise way to write algebraic data types,
109+
is quite flexible; among others it gives a more concise way to write [algebraic data types](http://dotty.epfl.ch/docs/reference/enums/adts.html),
105110
which would otherwise be expressed by a sealed base trait with case classes as alternatives.
106-
Scala enums will interop with en the host platform. They support multiversal equality
111+
Scala enums will interoperate with the host platform. They support multiversal equality
107112
out of the box, i.e. an enum can only be compared to values of the same enum type.
108113

109114
- Extension clauses `extension StringOps for String { ... }`
110115

111-
(Pending) Extension clauses allow to define extension methods and late implementations
116+
([Pending](https://github.com/lampepfl/dotty/pull/4114)) Extension clauses allow to define extension methods and late implementations
112117
of traits via instance declarations. They are more readable and convey intent better
113118
than the previous encodings of these features through implicit classes and value classes.
114119
Extensions will replace implicit classes. Extensions and opaque types together can
115-
replace almost all usages of value classes.
120+
replace almost all usages of value classes. Value classes are kept around for the
121+
time being since there might be a new good use case for them in the future if the host platform supports "structs" or some other way to express multi-field value classes.
116122

117123
<a name="performance"></a>
118124
## Performance
119125

120126
- Opaque Type Aliases `opaque type A = T`
121127

122-
(Pending) An opaque alias allows to define a new type `A` in terms of an existing type `T`. Unlike the previous modeling using value classes, opqaue types guarantee no boxing.
123-
Opaque types are described in detail in [SIP 35](https://docs.scala-lang.org/sips/opaque-types.html).
128+
([Pending](https://github.com/lampepfl/dotty/pull/4028)) An opaque alias defines a new type `A` in terms of an existing type `T`. Unlike the previous modeling using value classes, opaque types never box. Opaque types are described in detail in [SIP 35](https://docs.scala-lang.org/sips/opaque-types.html).
124129

125-
- Erased parameters
130+
- [Erased parameters](http://dotty.epfl.ch/docs/reference/erased-terms.html)
126131

127132
Parameters of methods and functions can be declared `erased`. This means that
128133
the corresponding arguments are only used for type checking purposes and no code
129134
will be generated for them. Typical candidates for erased parameters are type
130135
constraints impressed through implicits such as `=:=` and `<:<`. Erased parameters
131136
help both runtime (since no argument has to be constructed) and compile time
132137
(since potentially large arguments can be eliminated early).
133-
134-

docs/sidebar.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ sidebar:
2929
url: docs/reference/implicit-function-types.html
3030
- title: Dependent Function Types
3131
url: docs/reference/dependent-function-types.html
32-
- title: Literal Singleton Types
33-
url: docs/reference/singleton-types.html
3432
- title: Enums
3533
subsection:
3634
- title: Enumerations
@@ -95,6 +93,8 @@ sidebar:
9593
url: docs/reference/dropped/procedure-syntax.html
9694
- title: Early Initializers
9795
url: docs/reference/dropped/early-initializers.html
96+
- title: Class Shadowing
97+
url: docs/reference/dropped/class-shadowing.html
9898
- title: Limit 22
9999
url: docs/reference/dropped/limit22.html
100100
- title: XML literals

0 commit comments

Comments
 (0)