Interface F中的对象表达式和捕获状态#

Interface F中的对象表达式和捕获状态#,interface,f#,Interface,F#,是什么让第一个实现变得困难 type IToto = abstract Toto : unit -> unit { new IToto with member this.Toto = fun () -> () } { new IToto with member this.Toto () = () } 在编译表示法中,函数类型的属性(编译为FSharpFunc Toto{get;})与采用单元并返回单元

是什么让第一个实现变得困难

type IToto  = 
    abstract Toto : unit -> unit

{ new IToto with  
      member this.Toto = 
             fun () -> () }

{ new IToto with  
        member this.Toto () = ()  }

在编译表示法中,函数类型的属性(编译为
FSharpFunc Toto{get;}
)与采用单元并返回单元的方法(编译为
unit Toto()
)之间存在差异

第一个对象表达式实现不同的接口:

type IToto  = 
    abstract Toto : (unit -> unit) // Note: Parentheses around the function type!

{ new IToto with  
      member this.Toto = 
             fun () -> () }

这越来越微妙了。我喜欢。