Skip to content

proposal: Redefine strings.Join() as generic #71280

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
FGasper opened this issue Jan 15, 2025 · 2 comments
Closed

proposal: Redefine strings.Join() as generic #71280

FGasper opened this issue Jan 15, 2025 · 2 comments
Labels

Comments

@FGasper
Copy link

FGasper commented Jan 15, 2025

Proposal Details

It would be nice if strings.Join could join a slice of any string-like type. So this could work:

type SpecialString string;

mystrs := []SpecialString{"foo", "bar"}

joined := strings.Join(mystrs, ",")

… with joined being of type SpecialString.

Thank you for your consideration!

@gopherbot gopherbot added this to the Proposal milestone Jan 15, 2025
@mateusz834
Copy link
Member

Sorry, we cannot change signatures of any existing API (backwards compatibility). See proposal #71183 which might help in such cases.

@mateusz834 mateusz834 closed this as not planned Won't fix, can't repro, duplicate, stale Jan 15, 2025
@mateusz834 mateusz834 modified the milestones: Proposal, Backlog Jan 15, 2025
@FGasper
Copy link
Author

FGasper commented Jan 15, 2025

(For posterity, in case anyone else is wondering: this would break applications that assign strings.Join to a variable.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants