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

proposal: spec: allow convert ~[]interface{~byte|~rune} to string #64814

Open
leaxoy opened this issue Dec 20, 2023 · 3 comments
Open

proposal: spec: allow convert ~[]interface{~byte|~rune} to string #64814

leaxoy opened this issue Dec 20, 2023 · 3 comments
Labels
generics Issue is related to generics Proposal
Milestone

Comments

@leaxoy
Copy link

leaxoy commented Dec 20, 2023

Proposal Details

Currently we have generics, but can't convert byte or rune slice to string. https://go.dev/play/p/QIBgNfzHYFY

Let's support it.

@gopherbot gopherbot added this to the Proposal milestone Dec 20, 2023
@adonovan
Copy link
Member

adonovan commented Dec 20, 2023

To be more specific: today it is possible to apply the string(.) conversion to:

  • a byte or rune;
  • a []byte or []rune;
  • a type variable constrained to be []byte or []rune; but not
  • a type variable constrained to be a slice of elements constrained to byte or rune.

See https://go.dev/play/p/wrnZwb0pGfz

@griesemer @ianlancetaylor

@adonovan adonovan added the generics Issue is related to generics label Dec 20, 2023
@earthboundkid

This comment was marked as off-topic.

@griesemer
Copy link
Contributor

@carlmjohnson This is not a bug, but it's still unfortunate. Related: #63940 . Generics are hard.

@seankhliao seankhliao changed the title proposal: allow convert ~[]interface{~byte|~rune} to string proposal: spec: allow convert ~[]interface{~byte|~rune} to string Jan 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
generics Issue is related to generics Proposal
Projects
Status: Incoming
Development

No branches or pull requests

5 participants