Why can't a function with byref be converted directly to delegate?
问题 Under normal circumstances, F# functions can be converted to delegates by calling new DelegateType and passing in the function as an argument. But when the delegate contains byref parameter, this is not possible directly. For example the code: type ActionByRef<'a> = delegate of 'a byref -> unit let f (x:double byref) = x <- 6.0 let x = ref 42.0 let d = new ActionByRef<_>(f) won't compile, giving the following error: This function value is being used to construct a delegate type whose