let a = ref 0
let f (x: byref<int>) = x
f a // type error
System.Int32.TryParse("123",a) // works
f a
being a type error is puzzling to me since a
can be passed into .NET library methods with a byref<int>
type. Why?
Edit: I think I really explained the question poorly. The type of System.Int32.TryParse
is string * byref<int> -> bool
and yet it works. So why can't I pass a
into a function of type x:byref<int> -> int
? That is all I am asking.
byref<int>
but here has typeint ref
– Marko Grdinićbyref
in the call toTryParse
. What I am wondering is why isn't it doing for functions on the F# side? – Marko Grdinić