[swift-dev] [stdlib] Array.description calls debugDescription on its contents

Wojciech Czekalski wczekalski at me.com
Sun Dec 13 14:43:38 CST 2015


I agree with Brent that offering description on Arrays where it "shouldn't be presented to the user in raw form, ever, so the use case here is debugging”  is misleading. Is there any specific reason for them to offer it? Also, there is a slightly difference in representation of description and debugDescription for ContiguousArray and ArraySlice. If the motivation behind it is unclear it might be worth to remove either the difference in implementation or the conformance to CustomStringConvertible altogether.

-Wojtek

> Wiadomość napisana przez Dave Abrahams via swift-dev <swift-dev at swift.org> w dniu 12.12.2015, o godz. 21:41:
> 
> 
> 
> Sent from my moss-covered three-handled family gradunza
> 
>> On Dec 12, 2015, at 9:09 AM, Brent Royal-Gordon via swift-dev <swift-dev at swift.org> wrote:
>> 
>> 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.
> 
> Why would that be nice?  It is an explicit goal that every type can be represented as a string, whatever its conformance a, FWIW
> _______________________________________________
> swift-dev mailing list
> swift-dev at swift.org
> https://lists.swift.org/mailman/listinfo/swift-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-dev/attachments/20151213/39a3beef/attachment.html>


More information about the swift-dev mailing list