Computational expression using zero

When using a computational expression, the first definition works, and the second doesn't work for Zero.

What is the difference between this:

member o.Zero() = 3


and this:

member o.Zero = fun() -> 3


The first is evaluated as unit -> int

and the second is (unit -> int)

. What is the difference?


source to share

1 answer

If they are limited, there is no difference. However, in a class definition, the first o.Zero

is a method and the second o.Zero

is a property.

Evaluation of an expression expects a method named Zero

; why it didn't work when you provided a property with the same name.



All Articles