F# error FS0191: ‘inherit’ declarations may not have ‘as’ bindings

%f

This error happened after updating to latest may 2009 CTP. Sometimes I do not get the meaning of some error messages. I write this code:

type MyClass = class
    inherit Game as base

and I receive this error message:

error FS0191: 'inherit' declarations
may not have 'as' bindings. The
keyword 'base' may be used instead.
Remove this 'as' binding

I deleted as base from second line

type MyClass = class
    inherit Game

and program compiled fine (is it that simple?). But, I keep wondering if this would have some unexpected effects. Hence my questions:

Is it "may not have 'as' binding" or "cannot have 'as' binding" or "should not have 'as' binding"? What is the meaning of that error?

Best Answer

You did the right thing. Once upon a time, if you wanted to refer to the base class, you had to do the 'as base' thing (and could choose any identifier). Now 'base' is a keyword for referring to the base class, and the 'as base' syntax was deprecated and then removed.

(And you're right, it should say 'cannot' instead of 'may not', I'll go fix that right now.)

Related Topic