I have a vexing error.
type Animal =
abstract member Name : string
type Dog (name : string) =
interface Animal with
member this.Name : string =
name
let pluto = new Dog("Pluto")
let name = pluto.Name
The last line, specifically "Name" generates a compiler error saying that "the field, constructor or member 'Name' is not defined".
The workaround I've used is to write
let name = (pluto :> Animal).Name
However this is very annoying and creates a lot of visual noise. Is there something one can do in F# to just be able to resolve Name without telling the compiler explicitly that Name is a derived member from the Animal type?