]> Cypherpunks.ru repositories - gostls13.git/commitdiff
builtin: document "any" and "comparable"
authorIan Lance Taylor <iant@golang.org>
Thu, 2 Dec 2021 22:52:31 +0000 (14:52 -0800)
committerIan Lance Taylor <iant@golang.org>
Fri, 3 Dec 2021 01:09:21 +0000 (01:09 +0000)
Fixes #49927

Change-Id: I8b34cf13b3bc6338309f005648ca3ee6852927f0
Reviewed-on: https://go-review.googlesource.com/c/go/+/368954
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>

src/builtin/builtin.go

index 01190e99002d441da5a477fa9ec7c8f36a0df44b..9a94c7357d9b57fe412f9b790bda0c1a27b717bf 100644 (file)
@@ -91,6 +91,16 @@ type byte = uint8
 // used, by convention, to distinguish character values from integer values.
 type rune = int32
 
+// any is an alias for interface{} and is equivalent to interface{} in all ways.
+type any = interface{}
+
+// comparable is an interface that is implemented by all comparable types
+// (booleans, numbers, strings, pointers, channels, interfaces,
+// arrays of comparable types, structs whose fields are all comparable types).
+// The comparable interface may only be used as a type parameter constraint,
+// not as the type of a variable.
+type comparable comparable
+
 // iota is a predeclared identifier representing the untyped integer ordinal
 // number of the current const specification in a (usually parenthesized)
 // const declaration. It is zero-indexed.