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

Patrick Smith pgwsmith at gmail.com
Fri May 27 00:12:05 CDT 2016


> On 26 May 2016, at 5:40 PM, David Hart <david at hartbit.com> wrote:
> 
> I’ve always found those two confusing. But I guess that CustomDebugStringConvertible could provide more information, like the actual type and pointer value. For example, imagine that we make UIColor ValuePreservingStringConvertible, one implementation could look like:
> 
> let a = UIColor(red: 0, green: 0, blue: 0)
> a.description // #000000
> a.debugDescription // <UIColor: 0xcodebeef - red: 0.0, green: 0.0, blue: 0.0>

This distinction seems a little arbitrary to me. However, something like `preservedString` would make more sense to me:

let a = UIColor(red: 0, green: 0, blue: 0)
a.preservedString // #000000 — or perhaps more accurate: rgba(0.0,0.0,0.0,1.0)
a.debugDescription // <UIColor: 0xcodebeef - red: 0.0, green: 0.0, blue: 0.0>

This why I think it makes sense to really differentiate `description` from `debugDescription`, so it’s no long ‘confusing’ as you say.


More information about the swift-evolution mailing list