Closed as not planned
Closed as not planned
Description
When creating a generic data structure such as a Set[T comparable]
, it's also important to think about such properties as:
- zero values of T (such as
nil
interface values) - invalid values
- edge cases of comparability, such as "is
==
reflexive?" - for example float64NaN
values need special handling
These properties (and there are probably more) must be handled to avoid subtle errors in generic code, yet are also easy to overlook for beginners to generic programming like myself.
Would you consider adding a list of these properties to https://go.dev/doc/tutorial/generics or maybe https://go.dev/blog/when-generics (the two posts that have helped me the most with generics) or accepting a CL to add it?
Special thanks to @bcmills who brought this list up to me in the #generics Slack channel . I'm attaching a screenshot of our Slack conversation so it doesn't get lost in Slack history.