Why doesn't the F# Set implement ISet<T>?

Posted by Sean Devlin on Stack Overflow See other posts from Stack Overflow or by Sean Devlin
Published on 2010-04-01T19:03:46Z Indexed on 2010/04/01 21:13 UTC
Read the original article Hit count: 368

Filed under:
|
|
|

The .NET Framework is adding an ISet<T> interface with the 4.0 release. In the same release, F# is being added as a first-class language. F# provides an immutable Set<'T> class.

It would seem logical to me that the immutable set provided would implement the ISet<T> interface, but it doesn't. Does anyone know why?

My guess is that they didn't want to implement an interface intended to be mutable, but I don't think this explanation holds up. After all, their Map<'Key, 'Value> class implements IDictionary, which is mutable. And there are examples elsewhere in the framework of classes implementing interfaces that are only partially appropriate.

My other thought is that ISet<T> is new, so maybe they didn't get around to it. But that seems kind of thin.

Does the fact that ISet<T> is generic (v. IDictionary, which is not) have anything to do with it?

Any thoughts on the matter would be appreciated.

© Stack Overflow or respective owner

Related posts about F#

Related posts about interface