Cuong Manh Le has uploaded this change for review.
builtin: add documentation for min/max
Updates #59488
Change-Id: If873b81fb7f0e28b84a3e5c2ff89426b3e289d5d
---
M src/builtin/builtin.go
1 file changed, 10 insertions(+), 0 deletions(-)
diff --git a/src/builtin/builtin.go b/src/builtin/builtin.go
index bcfb7ce..473fdd2 100644
--- a/src/builtin/builtin.go
+++ b/src/builtin/builtin.go
@@ -10,6 +10,8 @@
*/
package builtin
+import "cmp"
+
// bool is the set of boolean values, true and false.
type bool bool
@@ -206,6 +208,14 @@
// unbuffered.
func make(t Type, size ...IntegerType) Type
+// The max built-in computes the largest value of a fixed number of arguments of
+// [cmp.Ordered] types. There must be at least one argument.
+func max[T cmp.Ordered](x T, y ...T) T
+
+// The min built-in computes the smallest value of a fixed number of arguments of
+// [cmp.Ordered] types. There must be at least one argument.
+func min[T cmp.Ordered](x T, y ...T) T
+
// The new built-in function allocates memory. The first argument is a type,
// not a value, and the value returned is a pointer to a newly
// allocated zero value of that type.
To view, visit change 498495. To unsubscribe, or for help writing mail filters, visit settings.
Attention is currently required from: Matthew Dempsky, Robert Griesemer.
Patch set 1:Run-TryBot +1
Attention is currently required from: Matthew Dempsky, Robert Griesemer.
1 comment:
Patchset:
Trybot failed will be fixed once https://go-review.googlesource.com/c/tools/+/498515 landed.
To view, visit change 498495. To unsubscribe, or for help writing mail filters, visit settings.
Attention is currently required from: Cuong Manh Le, Matthew Dempsky, Robert Griesemer.
1 comment:
File src/builtin/builtin.go:
Patch Set #1, Line 211: // The max built-in computes the largest value of a fixed number of arguments of
Everywhere else I think we say "built-in function", not just "built-in".
To view, visit change 498495. To unsubscribe, or for help writing mail filters, visit settings.
Attention is currently required from: Cuong Manh Le, Matthew Dempsky, Robert Griesemer.
Cuong Manh Le uploaded patch set #2 to this change.
The following approvals got outdated and were removed: Run-TryBot+1 by Cuong Manh Le, TryBot-Result-1 by Gopher Robot
builtin: add documentation for min/max
Updates #59488
Change-Id: If873b81fb7f0e28b84a3e5c2ff89426b3e289d5d
---
M src/builtin/builtin.go
1 file changed, 10 insertions(+), 0 deletions(-)
To view, visit change 498495. To unsubscribe, or for help writing mail filters, visit settings.
Attention is currently required from: Ian Lance Taylor, Matthew Dempsky, Robert Griesemer.
Patch set 1:Run-TryBot +1
Patch Set #1, Line 211: // The max built-in computes the largest value of a fixed number of arguments of
Everywhere else I think we say "built-in function", not just "built-in".
Acknowledged
To view, visit change 498495. To unsubscribe, or for help writing mail filters, visit settings.
Attention is currently required from: Ian Lance Taylor, Matthew Dempsky, Robert Griesemer.
Patch set 2:Run-TryBot +1
Attention is currently required from: Cuong Manh Le, Ian Lance Taylor, Robert Griesemer.
Patch set 2:Code-Review +2
1 comment:
File src/builtin/builtin.go:
Patch Set #2, Line 211: computes
nit: While "computes" is the wording the spec uses, I think "returns" is more natural wording in godocs.
gri/iant: WDYT?
To view, visit change 498495. To unsubscribe, or for help writing mail filters, visit settings.
Attention is currently required from: Cuong Manh Le, Matthew Dempsky, Robert Griesemer.
1 comment:
File src/builtin/builtin.go:
Patch Set #2, Line 211: computes
nit: While "computes" is the wording the spec uses, I think "returns" is more natural wording in god […]
I agree.
To view, visit change 498495. To unsubscribe, or for help writing mail filters, visit settings.
Attention is currently required from: Cuong Manh Le, Ian Lance Taylor, Matthew Dempsky.
1 comment:
File src/builtin/builtin.go:
Patch Set #2, Line 211: computes
I agree.
ACK.
To view, visit change 498495. To unsubscribe, or for help writing mail filters, visit settings.
Attention is currently required from: Cuong Manh Le, Ian Lance Taylor, Matthew Dempsky.
Cuong Manh Le uploaded patch set #3 to this change.
The following approvals got outdated and were removed: Run-TryBot+1 by Cuong Manh Le, TryBot-Result-1 by Gopher Robot
builtin: add documentation for min/max
Updates #59488
Change-Id: If873b81fb7f0e28b84a3e5c2ff89426b3e289d5d
---
M src/builtin/builtin.go
1 file changed, 10 insertions(+), 0 deletions(-)
To view, visit change 498495. To unsubscribe, or for help writing mail filters, visit settings.
Attention is currently required from: Ian Lance Taylor, Matthew Dempsky, Robert Griesemer.
Patch Set #2, Line 211: computes
ACK.
Done.
To view, visit change 498495. To unsubscribe, or for help writing mail filters, visit settings.
Attention is currently required from: Cuong Manh Le, Ian Lance Taylor, Matthew Dempsky, Robert Griesemer.
Patch set 3:Code-Review +2
1 comment:
Patchset:
LGTM but I'm not sure whether we can commit this yet given the x/tools test failure.
To view, visit change 498495. To unsubscribe, or for help writing mail filters, visit settings.
Attention is currently required from: Ian Lance Taylor, Matthew Dempsky, Robert Griesemer.
Patch set 4:Run-TryBot +1Auto-Submit +1
Attention is currently required from: Ian Lance Taylor, Matthew Dempsky, Robert Griesemer.
LGTM but I'm not sure whether we can commit this yet given the x/tools test failure.
https://go-review.googlesource.com/c/tools/+/498515 was landed, so trybot will be happy now 😊
To view, visit change 498495. To unsubscribe, or for help writing mail filters, visit settings.
Gopher Robot submitted this change.
3 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.
builtin: add documentation for min/max
Updates #59488
Change-Id: If873b81fb7f0e28b84a3e5c2ff89426b3e289d5d
Reviewed-on: https://go-review.googlesource.com/c/go/+/498495
TryBot-Result: Gopher Robot <go...@golang.org>
Reviewed-by: Ian Lance Taylor <ia...@google.com>
Auto-Submit: Cuong Manh Le <cuong.m...@gmail.com>
Reviewed-by: Matthew Dempsky <mdem...@google.com>
Run-TryBot: Cuong Manh Le <cuong.m...@gmail.com>
---
M src/builtin/builtin.go
1 file changed, 10 insertions(+), 0 deletions(-)
diff --git a/src/builtin/builtin.go b/src/builtin/builtin.go
index bcfb7ce..03e90c8 100644
--- a/src/builtin/builtin.go
+++ b/src/builtin/builtin.go
@@ -10,6 +10,8 @@
*/
package builtin
+import "cmp"
+
// bool is the set of boolean values, true and false.
type bool bool
@@ -206,6 +208,14 @@
// unbuffered.
func make(t Type, size ...IntegerType) Type
+// The max built-in function returns the largest value of a fixed number of
+// arguments of [cmp.Ordered] types. There must be at least one argument.
+func max[T cmp.Ordered](x T, y ...T) T
+
+// The min built-in function returns the smallest value of a fixed number of
+// arguments of [cmp.Ordered] types. There must be at least one argument.
+func min[T cmp.Ordered](x T, y ...T) T
+
// The new built-in function allocates memory. The first argument is a type,
// not a value, and the value returned is a pointer to a newly
// allocated zero value of that type.
To view, visit change 498495. To unsubscribe, or for help writing mail filters, visit settings.