# 符号在 f# 函数签名中意味着什么?
what does the # symbol mean in an f# function signature?
我见过这样定义的函数:
let private applyTarget (logger:#ILogger) ceiling target =
logger.Debug "enforce ceiling"
match target > ceiling with
| true -> ceiling | false -> target
签名中的#符号是什么意思?
logger:ILogger
和logger:#ILogger
有什么区别?
类型签名 #t
称为 "flexible type",对于 'a when 'a :> t
.[=14= 只是 shorthand ]
即#t
表示"any subtype of t
".
我见过这样定义的函数:
let private applyTarget (logger:#ILogger) ceiling target =
logger.Debug "enforce ceiling"
match target > ceiling with
| true -> ceiling | false -> target
签名中的#符号是什么意思?
logger:ILogger
和logger:#ILogger
有什么区别?
类型签名 #t
称为 "flexible type",对于 'a when 'a :> t
.[=14= 只是 shorthand ]
即#t
表示"any subtype of t
".