Skip to content

Commit d96b2a2

Browse files
committed
postponed addition of attribute {.scala}
1 parent 6bc9dd0 commit d96b2a2

File tree

15 files changed

+60
-60
lines changed

15 files changed

+60
-60
lines changed

docs/docs/reference/changed-features/main-functions.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ title: "Main Methods"
44
---
55

66
Scala 3 offers a new way to define programs that can be invoked from the command line:
7-
A `@main`{.scala} annotation on a method turns this method into an executable program.
7+
A `@main` annotation on a method turns this method into an executable program.
88
Example:
99

1010
```scala
@@ -30,13 +30,13 @@ This would generate a main program `happyBirthday` that could be called like thi
3030
Happy 23rd Birthday, Lisa and Peter!
3131
```
3232

33-
A `@main`{.scala} annotated method can be written either at the top-level or in a statically accessible object. The name of the program is in each case the name of the method, without any object prefixes. The `@main`{.scala} method can have an arbitrary number of parameters.
33+
A `@main` annotated method can be written either at the top-level or in a statically accessible object. The name of the program is in each case the name of the method, without any object prefixes. The `@main` method can have an arbitrary number of parameters.
3434
For each parameter type there must be an instance of the `scala.util.FromString` type class
3535
that is used to convert an argument string to the required parameter type.
3636
The parameter list of a main method can end in a repeated parameter that then
3737
takes all remaining arguments given on the command line.
3838

39-
The program implemented from a `@main`{.scala} method checks that there are enough arguments on
39+
The program implemented from a `@main` method checks that there are enough arguments on
4040
the command line to fill in all parameters, and that argument strings are convertible to
4141
the required types. If a check fails, the program is terminated with an error message.
4242

@@ -50,9 +50,9 @@ Illegal command line after first argument: more arguments expected
5050
Illegal command line: java.lang.NumberFormatException: For input string: "sixty"
5151
```
5252

53-
The Scala compiler generates a program from a `@main`{.scala} method `f` as follows:
53+
The Scala compiler generates a program from a `@main` method `f` as follows:
5454

55-
- It creates a class named `f` in the package where the `@main`{.scala} method was found
55+
- It creates a class named `f` in the package where the `@main` method was found
5656
- The class has a static method `main` with the usual signature. It takes an `Array[String]`
5757
as argument and returns `Unit`.
5858
- The generated `main` method calls method `f` with arguments converted using
@@ -76,7 +76,7 @@ final class happyBirthday:
7676
**Note**: The `<static>` modifier above expresses that the `main` method is generated
7777
as a static method of class `happyBirthDay`. It is not available for user programs in Scala. Regular "static" members are generated in Scala using objects instead.
7878

79-
`@main`{.scala} methods are the recommended scheme to generate programs that can be invoked from the command line in Scala 3. They replace the previous scheme to write program as objects with a special `App` parent class. In Scala 2, `happyBirthday` could be written also like this:
79+
`@main` methods are the recommended scheme to generate programs that can be invoked from the command line in Scala 3. They replace the previous scheme to write program as objects with a special `App` parent class. In Scala 2, `happyBirthday` could be written also like this:
8080

8181
```scala
8282
object happyBirthday extends App:

docs/docs/reference/changed-features/match-syntax.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ title: "Match Expressions"
44
---
55

66
The syntactical precedence of match expressions has been changed.
7-
`match`{.scala} is still a keyword, but it is used like an alphabetical operator. This has several consequences:
7+
`match` is still a keyword, but it is used like an alphabetical operator. This has several consequences:
88

9-
1. `match`{.scala} expressions can be chained:
9+
1. `match` expressions can be chained:
1010

1111
```scala
1212
xs match {
@@ -29,7 +29,7 @@ The syntactical precedence of match expressions has been changed.
2929
case "nonempty" => 1
3030
```
3131

32-
2. `match`{.scala} may follow a period:
32+
2. `match` may follow a period:
3333

3434
```scala
3535
if xs.match
@@ -41,7 +41,7 @@ The syntactical precedence of match expressions has been changed.
4141

4242
3. The scrutinee of a match expression must be an `InfixExpr`. Previously the scrutinee could be
4343
followed by a type ascription `: T`, but this is no longer supported. So `x : T match { ... }`
44-
now has to be written `(x: T) match { ... }`{.scala}.
44+
now has to be written `(x: T) match { ... }`.
4545

4646
## Syntax
4747

docs/docs/reference/changed-features/numeric-literals.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ gives a type error, since without an expected type `-10_000_000_000` is treated
6666

6767
### The FromDigits Trait
6868

69-
To allow numeric literals, a type simply has to define a `given`{.scala} instance of the
69+
To allow numeric literals, a type simply has to define a `given` instance of the
7070
`scala.util.FromDigits` type class, or one of its subclasses. `FromDigits` is defined
7171
as follows:
7272

docs/docs/reference/changed-features/operators.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ title: "Rules for Operators"
55

66
The rules for infix operators have changed in some parts:
77

8-
First, an alphanumeric method can be used as an infix operator only if its definition carries an `infix`{.scala} modifier. Second, it is recommended (but not enforced) to
9-
augment definitions of symbolic operators with `@targetName`{.scala} annotations. Finally,
8+
First, an alphanumeric method can be used as an infix operator only if its definition carries an `infix` modifier. Second, it is recommended (but not enforced) to
9+
augment definitions of symbolic operators with `@targetName` annotations. Finally,
1010
a syntax change allows infix operators to be written on the left in a multi-line expression.
1111

1212
## The `infix` Modifier
1313

14-
An `infix`{.scala} modifier on a method definition allows using the method as an infix operation. Example:
14+
An `infix` modifier on a method definition allows using the method as an infix operation. Example:
1515

1616
```scala
1717
import scala.annotation.targetName
@@ -54,7 +54,7 @@ any Unicode character `c` for which `java.lang.Character.isIdentifierPart(c)` re
5454

5555
Infix operations involving symbolic operators are always allowed, so `infix` is redundant for methods with symbolic names.
5656

57-
The `infix`{.scala} modifier can also be given to a type:
57+
The `infix` modifier can also be given to a type:
5858

5959
```scala
6060
infix type or[X, Y]

docs/docs/reference/changed-features/structural-types.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ val i3 = new Vehicle: // i3: Vehicle { val range: Int }
144144
i3.range
145145
```
146146

147-
The type of `i3` in this example is `Vehicle { val range: Int }`{.scala}. Hence,
147+
The type of `i3` in this example is `Vehicle { val range: Int }`. Hence,
148148
`i3.range` is well-formed. Since the base class `Vehicle` does not define a `range` field or method, we need structural dispatch to access the `range` field of the anonymous class that initializes `id3`. Structural dispatch
149149
is implemented by the base trait `reflect.Selectable` of `Vehicle`, which
150150
defines the necessary `selectDynamic` member.

docs/docs/reference/contextual/context-bounds.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ def g[T <: B : C](x: T): R = ...
3030
## Migration
3131

3232
To ease migration, context bounds in Dotty map in Scala 3.0 to old-style implicit parameters
33-
for which arguments can be passed either with a `(using ...)`{.scala} clause or with a normal application. From Scala 3.1 on, they will map to context parameters instead, as is described above.
33+
for which arguments can be passed either with a `(using ...)` clause or with a normal application. From Scala 3.1 on, they will map to context parameters instead, as is described above.
3434

3535
If the source version is `3.1` and the `-migration` command-line option is set, any pairing of an evidence
3636
context parameter stemming from a context bound with a normal argument will give a migration
37-
warning. The warning indicates that a `(using ...)`{.scala} clause is needed instead. The rewrite can be
37+
warning. The warning indicates that a `(using ...)` clause is needed instead. The rewrite can be
3838
done automatically under `-rewrite`.
3939

4040
## Syntax

docs/docs/reference/contextual/derivation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ ConstrApps ::= ConstrApp {‘with’ ConstrApp}
353353
| ConstrApp {‘,’ ConstrApp}
354354
```
355355

356-
Note: To align `extends`{.scala} clauses and `derives`{.scala} clauses, Scala 3 also allows multiple
356+
Note: To align `extends` clauses and `derives` clauses, Scala 3 also allows multiple
357357
extended types to be separated by commas. So the following is now legal:
358358

359359
```scala

docs/docs/reference/contextual/type-classes.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ A _type class_ is an abstract, parameterized type that lets you add new behavior
88
* expressing how a type you don't own (from the standard or 3rd-party library) conforms to such behavior
99
* expressing such a behavior for multiple types without involving sub-typing relationships (one `extends` another) between those types (see: [ad hoc polymorphism](https://en.wikipedia.org/wiki/Ad_hoc_polymorphism) for instance)
1010

11-
Therefore in Scala 3, _type classes_ are just _traits_ with one or more parameters whose implementations are not defined through the `extends`{.scala} keyword, but by **given instances**.
11+
Therefore in Scala 3, _type classes_ are just _traits_ with one or more parameters whose implementations are not defined through the `extends` keyword, but by **given instances**.
1212
Here are some examples of common type classes:
1313

1414
### Semigroups and monoids
@@ -272,9 +272,9 @@ end readerMonad
272272

273273
### Summary
274274

275-
The definition of a _type class_ is expressed with a parameterised type with abstract members, such as a `trait`{.scala}.
275+
The definition of a _type class_ is expressed with a parameterised type with abstract members, such as a `trait`.
276276
The main difference between subtype polymorphism and ad-hoc polymorphism with _type classes_ is how the definition of the _type class_ is implemented, in relation to the type it acts upon.
277-
In the case of a _type class_, its implementation for a concrete type is expressed through a `given`{.scala} instance definition, which is supplied as an implicit argument alongside the value it acts upon. With subtype polymorphism, the implementation is mixed into the parents of a class, and only a single term is required to perform a polymorphic operation. The type class solution
277+
In the case of a _type class_, its implementation for a concrete type is expressed through a `given` instance definition, which is supplied as an implicit argument alongside the value it acts upon. With subtype polymorphism, the implementation is mixed into the parents of a class, and only a single term is required to perform a polymorphic operation. The type class solution
278278
takes more effort to set up, but is more extensible: Adding a new interface to a
279279
class requires changing the source code of that class. But contrast, instances for type classes can be defined anywhere.
280280

docs/docs/reference/enums/adts.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ parameterized with a value parameter `x`. It is a shorthand for writing a
1919
case class that extends `Option`. Since `None` is not parameterized, it
2020
is treated as a normal enum value.
2121

22-
The `extends`{.scala} clauses that were omitted in the example above can also
22+
The `extends` clauses that were omitted in the example above can also
2323
be given explicitly:
2424

2525
```scala
@@ -30,12 +30,12 @@ enum Option[+T]:
3030

3131
Note that the parent type of the `None` value is inferred as
3232
`Option[Nothing]`. Generally, all covariant type parameters of the enum
33-
class are minimized in a compiler-generated `extends`{.scala} clause whereas all
33+
class are minimized in a compiler-generated `extends` clause whereas all
3434
contravariant type parameters are maximized. If `Option` was non-variant,
3535
you would need to give the extends clause of `None` explicitly.
3636

37-
As for normal enum values, the cases of an `enum`{.scala} are all defined in
38-
the `enum`{.scala}s companion object. So it's `Option.Some` and `Option.None`
37+
As for normal enum values, the cases of an `enum` are all defined in
38+
the `enum`s companion object. So it's `Option.Some` and `Option.None`
3939
unless the definitions are "pulled out" with an import:
4040

4141
```scala

docs/docs/reference/enums/desugarEnums.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ some terminology and notational conventions:
2323

2424
Simple cases and value cases are collectively called _singleton cases_.
2525

26-
The desugaring rules imply that class cases are mapped to case classes, and singleton cases are mapped to `val`{.scala} definitions.
26+
The desugaring rules imply that class cases are mapped to case classes, and singleton cases are mapped to `val` definitions.
2727

2828
There are nine desugaring rules. Rule (1) desugars enum definitions. Rules
29-
(2) and (3) desugar simple cases. Rules (4) to (6) define `extends`{.scala} clauses for cases that
30-
are missing them. Rules (7) to (9) define how such cases with `extends`{.scala} clauses
29+
(2) and (3) desugar simple cases. Rules (4) to (6) define `extends` clauses for cases that
30+
are missing them. Rules (7) to (9) define how such cases with `extends` clauses
3131
map into `case class`es or `val`s.
3232

3333
1. An `enum` definition
@@ -82,7 +82,7 @@ map into `case class`es or `val`s.
8282
```
8383
where `Bi` is `Li` if `Vi = '+'` and `Ui` if `Vi = '-'`. This result is then further
8484
rewritten with rule (8). Simple cases of enums with non-variant type
85-
parameters are not permitted (however value cases with explicit `extends`{.scala} clause are)
85+
parameters are not permitted (however value cases with explicit `extends` clause are)
8686

8787
5. A class case without an extends clause
8888
```scala
@@ -191,7 +191,7 @@ The `ordinal` method is only generated if the enum does not extend from `java.la
191191

192192
### Scopes for Enum Cases
193193

194-
A case in an `enum`{.scala} is treated similarly to a secondary constructor. It can access neither the enclosing `enum`{.scala} using `this`, nor its value parameters or instance members using simple
194+
A case in an `enum` is treated similarly to a secondary constructor. It can access neither the enclosing `enum` using `this`, nor its value parameters or instance members using simple
195195
identifiers.
196196

197197
Even though translated enum cases are located in the enum's companion object, referencing
@@ -202,13 +202,13 @@ A Java-compatible enum is an enum that extends `java.lang.Enum`. The translation
202202

203203
It is a compile-time error for a Java-compatible enum to have class cases.
204204

205-
Cases such as `case C`{.scala} expand to a `@static val`{.scala} as opposed to a `val`{.scala}. This allows them to be generated as static fields of the enum type, thus ensuring they are represented the same way as Java enums.
205+
Cases such as `case C` expand to a `@static val` as opposed to a `val`. This allows them to be generated as static fields of the enum type, thus ensuring they are represented the same way as Java enums.
206206

207207
### Other Rules
208208

209209
- A normal case class which is not produced from an enum case is not allowed to extend
210210
`scala.reflect.Enum`. This ensures that the only cases of an enum are the ones that are
211211
explicitly declared in it.
212212

213-
- If an enum case has an `extends`{.scala} clause, the enum class must be one of the
213+
- If an enum case has an `extends` clause, the enum class must be one of the
214214
classes that's extended.

0 commit comments

Comments
 (0)