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

Add new helper protocols to dump to control which child nodes are included in the dump #59

Closed
wants to merge 1 commit into from

Conversation

tahirmt
Copy link
Contributor

@tahirmt tahirmt commented Sep 24, 2022

Draft because it is based off of #58.

Motivation

The Current method of using CustomDumpReflectable can be used to include/exclude properties from the resulting dump but it requires implementing a custom mirror as described in

. So for example if someone wants to exclude one property from an object with 20 properties, it will require creating a map with 19 properties to create a custom mirror. With CustomDumpExcludedChildNodesProvider the same result can be achieved by 2-3 lines and a simple string based array.

Open to naming suggestions and improvements.

@tahirmt tahirmt changed the title Dump new procols Add new helper protocols to dump to control which child nodes are included in the dump Sep 24, 2022
@stephencelis
Copy link
Member

@tahirmt Thanks for these general explorations! Sorry to push back again on added protocol surface area, but we already think the 3 this repo ships with is a lot 😄

I wonder if there's a more general infrastructure we could provide for customization points like this. Like is there a concept similar to SwiftSyntax's Visitor, which could be used to fully customize how a dump is done for a given node. Might take more time to think about, but just wanted to give you an initial thought as a library maintainer.

The current method of using the CustomDumpReflectable can work to produce this but it requires a lot more work to implement for each type that needs it.
@tahirmt
Copy link
Contributor Author

tahirmt commented Oct 20, 2022

I'm going to close this since this isn't something we want to introduce

@tahirmt tahirmt closed this Oct 20, 2022
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

Successfully merging this pull request may close these issues.

2 participants