let a = ref 0
let f (x: byref<int>) = x
f a // type error
System.Int32.TryParse("123",a) // works
Run Code Online (Sandbox Code Playgroud)
f a作为一个类型错误令我感到困惑,因为a可以传递给byref<int>类型的.NET库方法.为什么?
编辑:我想我真的很难解释这个问题.该类型的System.Int32.TryParse是string * byref<int> -> bool,但它的工作原理.那么为什么我不能a进入类型的函数x:byref<int> -> int?这就是我要问的全部.
| 归档时间: |
|
| 查看次数: |
147 次 |
| 最近记录: |