Bogus "Duplicate definition of value" error from the F# compiler
f#
Solution
This happens when you also define a `get_foo` function:
let get_foo() = !foo
because the definition of `foo` creates a property that implements its own `get_foo` method so there is a clash. The F# compiler is confused by this and generates the bogus "duplicate definition error".
This bug has been reported to Microsoft and they are working on a fix but it won't make it into the next (VS11) release of F#.
Problem
The F# compiler sometimes rejects my code with a compile-time error of the form `Duplicate definition of value foo` pointing at a definition like this: ``` let foo = ref 0 ``` even though this is not a duplicate definition because there are no other definitions of `foo` in the whole file. Why does this happen?