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

Kadlet is not friendly to creating or modifying KDL data from code #2

Open
LemmaEOF opened this issue Sep 24, 2024 · 2 comments
Open

Comments

@LemmaEOF
Copy link

LemmaEOF commented Sep 24, 2024

If you want to serialize data from code down to KDL, Kadlet really wants to get in your way at the moment. KdlDocument and KdlNode are immutable, and there is no builder or other easy way to progressively create KDL data as you go through an object. On top of that, KdlNodes are expected to keep track of their own indentation level, meaning getting pretty-printed KDL that was created exclusively from code is functionally impossible. Right now Kadlet is great for deserializing KDL, but these issues make it a lot more work than it should be to serialize it.

It seems a few of these issues are fixed with Kadlet 0.2.0, but that's not currently available on Nuget.

@oledfish
Copy link
Owner

Thank you for your feedback and apologies for the late reply. I admit Kadlet's API isn't the nicest to work with, this was pretty much my first attempt at making a published library and there are several aspects that could have been done differently. When KDL v2 is officially out I plan on reviewing the codebase and take this into account.

Something I wanted to add is a KdlWriter object that constructs a KDL document programmatically and outputs it to a stream, but I assume this still wouldn't fit your use case. What does it look like, so I can have a better idea of what would work for you?

@LemmaEOF
Copy link
Author

The big thing with a KdlWriter like that is that node children are stored as a document as well, so being able to construct a KdlDocument easily and keep it around as a KdlDocument is critical if you want to construct KDL from code with the way the library is currently set up.

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

2 participants