microsoft / bond

Bond is a cross-platform framework for working with schematized data. It supports cross-language de/serialization and powerful generic mechanisms for efficiently manipulating data. Bond is broadly used at Microsoft in high scale services.
MIT License
2.61k stars 321 forks source link

[c#] support for system.collections.immutable collections #1161

Closed enioluwas closed 1 year ago

enioluwas commented 2 years ago

Closes #1159

Adds proper support for immutable collections as laid out in the issue description. Implemented this in a way such that the Bond C# package doesn't actually depend on System.Collections.Immutable, roughly following how it was done in Newtonsoft.Json.

The collections are constructed using the builders, which performs a lot better doing bulk operations.

The change to the codegen in Haskell is small, but since I don't have much experience, any suggestions to make it more idiomatic are welcome.

Added unit tests both for the compiler and for [de]serialization in C#.

chwarr commented 2 years ago

Thanks for the PR!

I have other commitments that I need to attend to at the moment, so I won't be able to review this PR for a while. It's on my to do list, however. I cannot give an estimate on when I will be able to review this, unfortunately.

enioluwas commented 1 year ago

Hey @chwarr any chance you could prioritize reviewing this? My team already depends on Bond for schema definitions, and partially for serialization. This feature is the last blocker in moving all our serialization to Bond, which would be a performance boost for us over JSON. Thanks!

enioluwas commented 1 year ago

Overall, LGTM. Thank you for the PR and for your patience.

Can you add:

  • an example project,
  • a note in the documentation (under the Custom Containers section?) about the special handing for the immutable types, and
  • an entry in the changelog under Unreleased.

Thanks.

Done! Added the immutable_collections example project. Let me know if the wording on any of the doc changes needs to be modified