I have two classes defined like so:
type foo () =
let getBar() =
new bar()
type bar () =
let getFoo() =
new foo()
The compiler is saying
The type 'bar' is not defined
Is there a way to do this?
I have two classes defined like so:
type foo () =
let getBar() =
new bar()
type bar () =
let getFoo() =
new foo()
The compiler is saying
The type 'bar' is not defined
Is there a way to do this?
this is where the and
keyword is used (have to be in the same file obvious):
type Foo () =
let getBar () =
Bar ()
and Bar () =
let getFoo () =
Foo ()
you can use this too if you have mutual recursive functions (or even values) - but there you have to add the rec
keyword to the first binding:
let rec f x = if x > 0 then g x else 0
and g x = f (x-1)