Re:Operator constraints in Go
by lalaithion on Monday May 23, 2022 @04:15PM
(#31484284)
For a function, it makes sense to just write two functions, the easiest to use, and the one with maximum flaxibility.
For a data structure, I recommend using
and then writing two constructors
[ Parent
| on HN ]
Personally, I very much dislike that this makes the zero value of `SearchTree[T]` not useful. I personally feel that anything which only handles data (as opposed to something like an os.File) shouldn't require explicit initialization.
I genuinely think I might personally converge on the `Comparator[T]` approach only (at least for types), for that reason.