Suppose I have a pair of obviously contrived C# classes like this:

public abstract class Foo {
    public abstract int[] LegalValues { get; }
    public virtual bool IsValueLegal(int val) {
        return Array.IndexOf(LegalValues, val) >= 0;
    }
}

and this:

public class Bar : Foo {
    static int[] _legalValues = new int[] { 0, 1 }; // whatever
    public sealed override int[] LegalValues 
        { get { return _legalValues; } }
    public sealed override bool IsValueLegal(int val)
        { return base.IsValueLegal(val); }
}

How do I do this in F#? The obvious code for the properties:

[<Sealed>]
override this.LegalValues with get() = // ...

[<Sealed>]
override this.IsValueLegal value = // ...

Triggers an error because the SealedAttribute apparently can't be applied to members. I can, of course, seal the entire class and thereby seal all members, but (and this is a really important but) is that I have a goal of matching an existing class signature exactly and the base class has other virtual/abstract members that should, ideally, remain overridable.

Edit
Report