Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

go/types: Predicates export #7295

gopherbot opened this issue Feb 10, 2014 · 3 comments

go/types: Predicates export #7295

gopherbot opened this issue Feb 10, 2014 · 3 comments


Copy link

by MWSherman:

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 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.
Copy link

Comment 1:

Labels changed: added repo-tools.

Owner changed to @griesemer.

Status changed to Thinking.

Copy link

Comment 2:

Labels changed: added release-none.

@rsc rsc added this to the Unplanned milestone Apr 10, 2015
@rsc rsc removed the release-none label Apr 10, 2015
@rsc rsc changed the title Predicates export x/tools/go/types: Predicates export Apr 14, 2015
@rsc rsc modified the milestones: Unreleased, Unplanned Apr 14, 2015
@rsc rsc removed the repo-tools label Apr 14, 2015
@griesemer griesemer changed the title x/tools/go/types: Predicates export go/types: Predicates export Jul 31, 2015
Copy link

I'm going to close this due to age. There are work-arounds. If a strong case is made for extending the API with predicates, we can re-open.

@golang golang locked and limited conversation to collaborators Dec 20, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet

No branches or pull requests

3 participants