diff options
| author | Ian Lance Taylor <iant@golang.org> | 2021-09-24 10:34:50 -0700 |
|---|---|---|
| committer | Ian Lance Taylor <iant@golang.org> | 2021-09-24 17:35:24 +0000 |
| commit | 845308703bc184005ef2ee2c7420df16d7553bf0 (patch) | |
| tree | 1e8b25cfee2c09dcf4768d3ecc031f6d15cb55fa | |
| parent | 56336a0a5f9ed7545e70d6dac2c6685cbed388c8 (diff) | |
| download | go-x-proposal-845308703bc184005ef2ee2c7420df16d7553bf0.tar.xz | |
design/43651-type-parameters: minor formatting/wording fixes
Change-Id: I3eba2d2d24c23d8c9e371ea1a123be32ae84cbaa
Reviewed-on: https://go-review.googlesource.com/c/proposal/+/352114
Trust: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
| -rw-r--r-- | design/43651-type-parameters.md | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/design/43651-type-parameters.md b/design/43651-type-parameters.md index 77e9b43..89b78cf 100644 --- a/design/43651-type-parameters.md +++ b/design/43651-type-parameters.md @@ -1893,8 +1893,6 @@ second string }`. Let's return now to type sets to cover some less important details that are still worth noting. -These are not additional rules or concepts, but are consequences of -how type sets work. #### Both elements and methods in constraints @@ -1906,7 +1904,7 @@ elements and methods. // type that is both 1) defined as a signed integer type; // 2) has a String method. type StringableSignedInteger interface { - ~int | ~int8 | ~int16 | ~int32| ~int64 + ~int | ~int8 | ~int16 | ~int32 | ~int64 String() string } ``` @@ -2853,7 +2851,7 @@ The ideas are presented in the form of a FAQ. An earlier draft design of generics implemented constraints using a new language construct called contracts. -Type sets appeared only in contracts, rather than on interface types. +Type sets appeared only in contracts, rather than in interface types. However, many people had a hard time understanding the difference between contracts and interface types. It also turned out that contracts could be represented as a set of @@ -3779,7 +3777,7 @@ func (lst *List[T]) Push(v T) { lst.head = &element[T]{val: v} lst.tail = lst.head } else { - lst.tail.next = &element[T]{val: v } + lst.tail.next = &element[T]{val: v} lst.tail = lst.tail.next } } @@ -4210,7 +4208,7 @@ literals of generic types. ``` type Pair[T any] struct { f1, f2 T } -var V = Pair{1, 2} // inferred as Pair(int){1, 2} +var V = Pair{1, 2} // inferred as Pair[int]{1, 2} ``` It's not clear how often this will arise in real code. |
