Skip to content

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

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

Closed
leaxoy opened this issue Dec 20, 2023 · 4 comments
Closed

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

leaxoy opened this issue Dec 20, 2023 · 4 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.

@ianlancetaylor ianlancetaylor moved this to Incoming in Proposals Jan 2, 2024
@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
@ianlancetaylor
Copy link
Contributor

Closing in favor of #70128, which addresses the general issue.

@ianlancetaylor ianlancetaylor closed this as not planned Won't fix, can't repro, duplicate, stale Nov 8, 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
None yet
Development

No branches or pull requests

6 participants