F# byref param not mutable

Viewed 131

I need to assign to a byref parameter, but, using F# 4.0 and .NET 4.5.2 on a Windows 8x64 box, I keep getting complaints that This value is not mutable. I can't change the signature, because I'm implementing a COM interface. Minimal broken example:

module Utils = 
    let bugFix1([<System.Runtime.InteropServices.Out>] ID : System.String byref) = ID <- "Hi!"
    let bugFix1([<System.Runtime.InteropServices.Out>] ID : int byref) = ID <- 0
    let bugFix1([<System.Runtime.InteropServices.Out>] ID : System.Guid byref) = ID <- System.Guid.NewGuid()

By this value, it definitely means ID, because it doesn't matter what I assign to ID. Note too, that it doesn't matter whether the type is blittable or not, or whether it is heap- or stack-allocated.

Is there some way do declare ID as mutable?

1 Answers
Related