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/constant: add Kind.String #46211

Closed
mdempsky opened this issue May 17, 2021 · 2 comments
Closed

go/constant: add Kind.String #46211

mdempsky opened this issue May 17, 2021 · 2 comments

Comments

@mdempsky
Copy link
Member

This proposal is to add a

func (Kind) String() string

method to go/constant.Kind for returning the kind's name.

Rationale: When debugging cmd/compile and go/types issues involving go/constant.Value, I'm often finding myself checking the Value.Kind(). However, printing these out with Printf simply prints the ordinal value, and I can never remember which constant kinds are which. It would be very convenient if they just printed as "Int" or "Float" directly.

/cc @griesemer

@gopherbot gopherbot added this to the Proposal milestone May 17, 2021
@griesemer griesemer self-assigned this May 17, 2021
@griesemer
Copy link
Contributor

Agreed. I've been annoyed by this myself often enough.
This doesn't need to be a proposal. CL forthcoming.

@gopherbot
Copy link

Change https://golang.org/cl/320491 mentions this issue: [dev.typeparams] go/constant: implement Kind.String

@griesemer griesemer changed the title proposal: go/constant: add Kind.String go/constant: add Kind.String May 17, 2021
@golang golang locked and limited conversation to collaborators Jun 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants