I'm not against a join that works on any CustomStringConvertible but that's
more or less the same thing as collection.map { String($0
}.joinWithSeparator("-"). If I had to guess, it wasn't done because people
weren't sure that it'd be that useful.
Félix
> Le 25 déc. 2015 à 02:49:11, Sebastian Mecklenburg via swift-evolution
> <[email protected]> a écrit :
>
> Hello group,
>
> This is my first post here so please tell me if I’m doing something wrong.
>
> The function name joinWithSeparator() sounds like an ObjectiveCism to me. Why
> not just name it join()? I is a common function found in many libraries of
> other programming languages and it is always simply called join(). I don’t
> think there is much room for misunderstanding what the parameter does.
>
> Also, why is it limited to String only SequenceTypes? An implementation like
>
> extension SequenceType {
> func join(separator: String) -> String {
> let arr = self.map({String($0)})
> return arr.joinWithSeparator(separator)
> }
> }
>
> would work fine with all classes that implement the CustomStringConvertible
> protocol and, for classes that don’t, the worst thing that would happen is
> that it would generate a string of repeating class names.
>
> What do you think?
>
> Thanks and regards,
> Sebastian Mecklenburg
>
> _______________________________________________
> swift-evolution mailing list
> [email protected]
> https://lists.swift.org/mailman/listinfo/swift-evolution
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution