Skip to content

Commit 5233bd9

Browse files
committed
Consistent terminology on type parameters
1 parent dfb5b04 commit 5233bd9

File tree

7 files changed

+14
-14
lines changed

7 files changed

+14
-14
lines changed

_overviews/core/architecture-of-scala-collections.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ construct another `BitSet` provided the element type of the collection to build
270270
is `Int`. If this is not the case, the compiler will check the superclasses, and
271271
fall back to the implicit builder factory defined in
272272
`mutable.Set`'s companion object. The type of this more general builder
273-
factory, where `A` is a generic type parameter, is:
273+
factory, where `A` is a type parameter, is:
274274

275275
CanBuildFrom[Set[_], A, Set[A]]
276276

_overviews/parallel-collections/performance.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ garbage collections.
4545
One common cause of a performance deterioration is also boxing and unboxing
4646
that happens implicitly when passing a primitive type as an argument to a
4747
generic method. At runtime, primitive types are converted to objects which
48-
represent them, so that they could be passed to a method with a generic type
48+
represent them, so that they could be passed to a method with a type
4949
parameter. This induces extra allocations and is slower, also producing
5050
additional garbage on the heap.
5151

_overviews/scala3-book/fun-hofs.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ p: A => Boolean
6161
{% endtabs %}
6262

6363
means that whatever function you pass in must take the type `A` as an input parameter and return a `Boolean`.
64-
So if your list is a `List[Int]`, you can replace the generic type `A` with `Int`, and read that signature like this:
64+
So if your list is a `List[Int]`, you can replace the type parameter `A` with `Int`, and read that signature like this:
6565

6666
{% tabs filter-definition_2 %}
6767
{% tab 'Scala 2 and 3' %}

_overviews/scala3-book/fun-write-map-function.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Focusing only on a `List[Int]`, you state:
1818
> I want to write a `map` method that can be used to apply a function to each element in a `List[Int]` that it’s given, returning the transformed elements as a new list.
1919
2020
Given that statement, you start to write the method signature.
21-
First, you know that you want to accept a function as a parameter, and that function should transform an `Int` into some generic type `A`, so you write:
21+
First, you know that you want to accept a function as a parameter, and that function should transform an `Int` into some type `A`, so you write:
2222

2323
{% tabs map-accept-func-definition %}
2424
{% tab 'Scala 2 and 3' %}
@@ -28,7 +28,7 @@ def map(f: (Int) => A)
2828
{% endtab %}
2929
{% endtabs %}
3030

31-
The syntax for using a generic type requires declaring that type symbol before the parameter list, so you add that:
31+
The syntax for using a type parameter requires declaring it in square brackets `[]` before the parameter list, so you add that:
3232

3333
{% tabs map-type-symbol-definition %}
3434
{% tab 'Scala 2 and 3' %}
@@ -48,7 +48,7 @@ def map[A](f: (Int) => A, xs: List[Int])
4848
{% endtab %}
4949
{% endtabs %}
5050

51-
Finally, you also know that `map` returns a transformed `List` that contains elements of the generic type `A`:
51+
Finally, you also know that `map` returns a transformed `List` that contains elements of the type `A`:
5252

5353
{% tabs map-with-return-type-definition %}
5454
{% tab 'Scala 2 and 3' %}
@@ -98,7 +98,7 @@ def map[A](f: (Int) => A, xs: List[Int]): List[A] =
9898
### Make it generic
9999

100100
As a bonus, notice that the `for` expression doesn’t do anything that depends on the type inside the `List` being `Int`.
101-
Therefore, you can replace `Int` in the type signature with the generic type parameter `B`:
101+
Therefore, you can replace `Int` in the type signature with the type parameter `B`:
102102

103103
{% tabs map-function-full-generic class=tabs-scala-version %}
104104
{% tab 'Scala 2' %}

_overviews/scala3-book/methods-most.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ This section introduces the various aspects of how to define and call methods in
1414

1515
Scala methods have many features, including these:
1616

17-
- Generic (type) parameters
17+
- Type parameters
1818
- Default parameter values
1919
- Multiple parameter groups
2020
- Context-provided parameters
@@ -690,7 +690,7 @@ There’s even more to know about methods, including how to:
690690
- Handle exceptions
691691
- Use vararg input parameters
692692
- Write methods that have multiple parameter groups (partially-applied functions)
693-
- Create methods that have generic type parameters
693+
- Create methods that have type parameters
694694

695695
{% comment %}
696696
Jamie: there really needs better linking here - previously it was to the Scala 3 Reference, which doesnt cover any

_overviews/scala3-book/methods-summary.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ There’s even more to know about methods, including how to:
1818
- Handle exceptions
1919
- Use vararg input parameters
2020
- Write methods that have multiple parameter groups (partially-applied functions)
21-
- Create methods that have generic type parameters
21+
- Create methods that have type parameters
2222

2323
See the [Reference documentation][reference] for more details on these features.
2424

_overviews/scala3-macros/tutorial/quotes.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -250,21 +250,21 @@ case ...
250250
### Matching types
251251

252252
So far, we assumed that the types within quote patterns would be statically known.
253-
Quote patterns also allow for generic types and existential types, which we will see in this section.
253+
Quote patterns also allow for type parameters, which we will see in this section.
254254

255-
#### Generic types in patterns
255+
#### Type parameters in patterns
256256

257257
Consider the function `exprOfOption` that we have already seen:
258258
```scala
259259
def exprOfOption[T: Type](x: Expr[Option[T]])(using Quotes): Option[Expr[T]] =
260260
x match
261261
case '{ Some($x: T) } => Some(x) // x: Expr[T]
262-
// ^^^ type ascription with generic type T
262+
// ^^^ type ascription with type T
263263
...
264264
```
265265

266266
Note that this time we have added the `T` explicitly in the pattern, even though it could be inferred.
267-
By referring to the generic type `T` in the pattern, we are required to have a given `Type[T]` in scope.
267+
By referring to the type parameter `T` in the pattern, we are required to have a given `Type[T]` in scope.
268268
This implies that `$x: T` will only match if `x` is of type `Expr[T]`.
269269
In this particular case, this condition will always be true.
270270

0 commit comments

Comments
 (0)