Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Amazing implement CustomStringConvertible somehow #27

Open
ghost opened this issue Oct 30, 2018 · 1 comment
Open

Make Amazing implement CustomStringConvertible somehow #27

ghost opened this issue Oct 30, 2018 · 1 comment

Comments

@ghost
Copy link

ghost commented Oct 30, 2018

This one is beyond me: Amazing uses String(describing: self) in the computed property description. When I try to make Amazing implement CustomStringConvertible, the compiler does not complain, but I run into a BAD 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 computed description property instead but this also gives a BAD EXEC at runtime.

@divadretlaw
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant