[swift-dev] [stdlib] Array.description calls debugDescription on its contents
brent at architechies.com
Sat Dec 12 13:09:28 CST 2015
> Nobody should be using '.description' or '.debugDescription' directly
> in any case. One should be using String(x) or String(reflecting: x),
> because that works with any instances, including those cases when the
> runtime will synthesize the string representation for you.
It would similarly be nice if String.init(_: Any) were instead String.init(_: CustomStringConvertible), and passing something to it that wasn’t convertible was an error. Similarly for string interpolation (although particular types would need a way to specify additional interpolatable types they supported).
More information about the swift-dev