From 0ad15d60d962e2e90d15065c31e718ef6fa78474 Mon Sep 17 00:00:00 2001 From: Eccles <1104895+eccles@users.noreply.github.com> Date: Wed, 10 Sep 2025 11:13:44 +0100 Subject: [PATCH] Clarify explicit Comparable constraint --- set.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/set.go b/set.go index 285edb2..51a5077 100644 --- a/set.go +++ b/set.go @@ -60,6 +60,17 @@ // To fix this the various types that make up 'comparable' must be explicitly enumerated in the // Comparable type. This is fragile as this may change in subsequent Go versions. // +// type Comparable[T any] interface { +// ~int | ~int8 | ~int16 | ~int32 | ~int64 | +// ~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~uintptr | +// ~float32 | ~float64 | +// ~string | Comparer[T] +// } +// +// and it is unclear how to generalise this to (say) structs and pointers of any type. +// +// Ref: https://github.com/golang/go/issues/51259 +// // Ref: https://go.dev/blog/comparable // // An alternative would be to use: