What makes the first implementation KO ?
type IToto =
abstract Toto : unit -> unit
{ new IToto with
member this.Toto =
fun () -> () }
{ new IToto with
member this.Toto () = () }
In the compile representation, there is a difference between property of a function type, compiled as FSharpFunc<unit, unit> Toto { get; }
, and a method taking unit and returning unit, compiled as unit Toto()
.
The first object expression implements a different interface:
type IToto =
abstract Toto : (unit -> unit) // Note: Parentheses around the function type!
{ new IToto with
member this.Toto =
fun () -> () }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With