R – Should I use inherit or interface

f#inheritanceinterface

What is the difference between:

type IFooable =
    interface IDisposable

    abstract Foo : (unit -> unit)

and

type IFooable =
    inherit IDisposable

    abstract Foo : (unit -> unit)

?

If equivalent, in which cases should I use one over the other ?
Thanks!

Best Solution

(I originally thought that) You must use 'inherit' with (at most one) base class. You can use 'interface' for any interfaces you are going to implement.

So in the case of IDisposable, it must be 'interface'.

EDIT, ok the compiler allows it, but that might be a bug, I'll look

EDIT: turns out it's a likely bug the other way, and likely interfaces will force you to use 'inherit' to inherit other interfaces, the idea being that 'inherited' members are always directly visible in the 'implicit interface' sense, whereas an 'interface' declaration on a class is an 'explicit' interface that requires a cast to that interface type to use those members. One way or another, we're likely to remove this flexibility in the language syntax so that there is only one way to author this, rather than two equivalent ways.