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

⬇️ Downgrade System.Collections.Immutable #382

Merged
merged 3 commits into from
Mar 11, 2024

Conversation

tomrijnbeek
Copy link
Member

✨ What's this?

This PR downgrades the System.Collections.Immutable reference to 6.0.0.

It also replaces some references to ImmutableList to ImmutableArray which is a more appropriate data structures in our use cases.

🔍 Why do we want this?

System.Collections.Immutable isn't a "true" NuGet package. Rather it is part of the .NET runtime. Therefore, as long as we support .NET 6, we should stick with the current version.

Now... why not drop .NET 6 support you might ask? Well, because the Roslyn Source Generators in Rider completely break down if you target a runtime newer than .NET 6. If we want to be able to keep using types from Bearded.Utilities in binaries referenced by source generators (for example, in TD we use Id<T>) we will want to stick with .NET 6 for now.

One change to consider is to split the complex types, such as the algorithms and data structures, from the simpler stuff, so that it becomes easier to access some of the more atomic types (which could target a relatively low .NET version because we use no advanced features) without needing to pull in the bigger dependencies needed for complex code.

The change from ImmutableList to ImmutableArray is to ensure that access by index is a constant time operation.

🏗 How is it done?

Manual replacement in VS Code.

💥 Breaking changes

There is only one case where the public API used ImmutableList, that is the return type of CoffmanGraham. If you only rely on that being a collection anyway, code should remain compatible when recompiling (less likely to be binary compatible).

@tomrijnbeek tomrijnbeek merged commit ed80950 into master Mar 11, 2024
1 check passed
@tomrijnbeek tomrijnbeek deleted the immutable-collections branch March 11, 2024 19:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants