[swift-evolution] [swift-evolution-announce] [Returned for revision] SE-0089: Renaming String.init<T>(_: T)

Chris Lattner clattner at apple.com
Sun May 29 14:16:03 CDT 2016


> On May 28, 2016, at 10:46 PM, Patrick Smith <pgwsmith at gmail.com> wrote:
> 
> Thanks for replying Chris!
> 
>> On 29 May 2016, at 6:00 AM, Chris Lattner <clattner at apple.com> wrote:
>> 
>> 2) If a value wants a better, or more customized, string form, then it conforms to CustomStringConvertible.
> 
> 
> What are the use cases for this more customized string form?

print() and string interpolation use it.  You conform to it and implement it when you want something specific to your type, otherwise you get the default reflection based implementation.  The reflection implementation is better than nothing, but usually not what you want.

-Chris



More information about the swift-evolution mailing list