You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Some API ideas for an approach to exporting methods in predicates.go.
(Follow-on to a short discussion here:
https://golang.org/issue/6634?c=11).
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 export.
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:
by MWSherman:
The text was updated successfully, but these errors were encountered: