TIL calling `CustomStringConvertible.description` property directly is discouraged
Interesting discussion How to avoid calling CustomStringConvertible.description
as a property?
Documentation CustomStringConvertible.description
states:
Calling this property directly is discouraged. Instead, convert an instance of any type to a string by using the
String(describing:)
initializer. This initializer works with any type, and uses the custom description property for types that conform toCustomStringConvertible
.
Hmm. It’s interesting that documentation doesn’t mention why String(describing:)
is the preferred method of converting a value of any type to a
String`.