When using a computational expression, the first definition works but the second does not for Zero.
What is the difference between this:
member o.Zero() = 3
and this:
member o.Zero = fun() -> 3
The first evaluates to unit -> int
and the second to (unit -> int)
. What is the difference?
If they are let-bounds, there is no difference. However, in a class definition the first o.Zero
is a method while the second o.Zero
is a property.
Computation expression expects a method named Zero
; that's why it didn't work when you provided a property with the same name.