Reputation: 12104
I'm pretty new to F# so I'm not quite sure what I'm doing wrong here here's what I'm trying to do:
type MyClass() =
let someVar = this.MyMember()
member this.MyMember() :unit =
// insert some code here
I can't do that because Visual Studio tells me that "this" isn't defined so what should I do? am I missing some obvious feature of F# or something?
I tried making all my members functions instead... but then I'd have to re-order all the functions so they become visible and then it still wouldn't work
so what do?
Upvotes: 4
Views: 501
Reputation: 25516
You need to insert a self-identifier. This is not done by default for some performance reasons.
The following works:
type MyClass() as this =
let someVar = this.MyMember()
member this.MyMember() :unit = ()
Upvotes: 8