2015-07-10 94 views

回答

4

由于None被隐含地表示为null,Option是参考类型。

的F#规范给出了需要的选项是一个引用类型定义如下:

[<DefaultAugmentation(false)>] 
[<CompilationRepresentation(CompilationRepresentationFlags.UseNullAsTrueValue)>]  
type 'T option = 
    | None 
    | Some of 'T 
    static member None : 'T option 
    static member Some : 'T -> 'T option 
    [<CompilationRepresentation(CompilationRepresentationFlags.Instance)>] 
    member Value : 'T 
    member IsSome : bool 
    member IsNone : bool  
0
type Option<'T> = 
     | None :  'T option 
     | Some : Value:'T -> 'T option 

FSharp Source Code示出了被引用类型。