[Pitch] Suggestion for `joined(separator:)` signature

I'm surprised that the signature for joined isn't using the argument label by:

Currently we have:

[a, b, c].joined(separator: "\n")

Rather than:

[a, b, c].joined(by: "\n")

The latter is more readable, and is what I'd expect given the guidelines:


I agree that joined(separator: "\n") is actually not as nicely named as it should be.

However (and forgive me, I am not a native speaker) wouldn't joined(by:) mean that something is added to an existing group (like: "later we were joined by my friend Peter") and the correct term would actually be joined(with:)?

1 Like

Good point! Now you mention that, by does not sound great. Perhaps separator is best after all... as it's clear what the parameter is used for. Reading with or by makes the assumption the user knows how the parameter is used, where separator doesn't read well, but at least it's explicit.