Open ghowen opened 5 years ago
It does not overwrite the default implementation. String(describing: self)
simply checks if self
conforms to CustomStringConvertible
and if it does it will use self.description
therefore we will run into a loop resulting in BAD_EXEC
.
If self
does not conform to CustomStringConvertible
, CustomDebugStringConvertible
or TextOutputStreamable
it will use the Swift Standard Library implementation. I'm unsure if we can (or even should) use the Swift Standard Library implementation directly as it uses internal functions.
This one is beyond me:
Amazing
usesString(describing: self)
in the computed propertydescription
. When I try to make Amazing implementCustomStringConvertible
, the compiler does not complain, but I run into aBAD EXEC
at runtime.It looks like as this overwrites the default implementation, which I need to access to get the description.
If someone is smart enough to find a way to achieve this, this would be great, as we already are compliant to the protocol. I just don't know how to express this.
I also tried to use
String(reflecting: self)
in the computeddescription
property instead but this also gives aBAD EXEC
at runtime.