Some API ideas for an approach to exporting methods in predicates.go.
(Follow-on to a short discussion here:
I’m glad that Comparable was exported. The use cases there, I assume, are to allow the
user to determine:
- whether the == operator can be used on the type
- whether the type can be used as a map key
@gordon rightly pointed out that many of those methods are small boilerplate helpers,
and thus would crowd the API, but perhaps we might consider establishing a qualification
For example, exporting Ordered will allow the user to determine usable operators (as
above), in this case < and >. I’d be tempted to export Numeric, since that also
describes a class of legal operations.
One other that comes to mind is “Addable”, which would encompass types for which the
+ operator is legal, presumably something like IsNumeric | IsString.
The text was updated successfully, but these errors were encountered: