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
Backport .NET 4.5 readonly collection interfaces #35
Comments
Problem: F# doesn't have variance annotations. |
Solution 2 done in https://github.com/mausch/VariantInterfaces |
Ongoing work in https://github.com/mausch/fsharpx/tree/readonlycollections |
Another problem: F# doesn't support TypeForwardedToAttribute, necessary for backwards compatibility in the .NET 4.5 build of FSharpx. http://fpish.net/topic/Some/0/75803 |
Wrote interfaces and adapters in C# https://github.com/mausch/ReadOnlyCollections . |
Can we ILMerge this stuff into FSharpx? |
Yup, but I started considering releasing it separately: one package only for the interfaces (ReadOnlyCollectionInterfaces), another for the adapters (ReadOnlyCollectionExtensions). The interfaces package would only reflect what's already there in .NET 4.5. So if you don't like those adapters and want to write your own, you could still take a dependency on ReadOnlyCollectionInterfaces. Also this would probably make things more portable... e.g. I implemented ReadOnlyCollectionExtensions for .NET 2.0 via LinqBridge. Personally though I don't really care for .NET 2.0 :) Of course, I really like FSharpx not depending on anything. But if this is merged into FSharpx and also released separately, if someone installs both they'll have a conflict. A solution around that would be to install a ReadOnlyCollectionInterfaces that only consists of forwarding types to FSharpx. But I don't know how I'd package something like that. |
Including this (either by merging or depending on ReadOnlyCollectionInterfaces) would mean adding a specific target for .NET 4.5 to FSharpx (to avoid a conflict with the built-in IReadOnly* interfaces) |
I released https://github.com/mausch/ReadOnlyCollections in two separate packages, I really think it's the easiest and most flexible approach. From the F# / FSharpx point of view, we have a few alternatives:
|
Can we close this issue? The dependencies this introduces just don't seem worth it - the new interfaces aren't that significant for F# programming, and adaptors can always be used instead. |
Closing this for now to avoid the dependency management problems that would result. |
IReadOnlyCollection: http://msdn.microsoft.com/en-us/library/hh881542.aspx
IReadOnlyList : http://msdn.microsoft.com/en-us/library/hh192385(v=vs.110).aspx
IReadOnlyDictionary: http://msdn.microsoft.com/en-us/library/hh136548(v=vs.110).aspx
ifdef it to ensure they don't get compiled on .NET 4.5.
Adapters to expose:
TryFind for IReadOnlyList and IReadOnlyDictionary
The text was updated successfully, but these errors were encountered: