Let measures support interlocked types
- Dominant language
- F#
- Stars
- 4.3k
- Forks
- 876
- Avg merge
- 4d 11h
- Merged PRs (30d)
- 131
Description
**Is your feature request related to a problem? Please describe.**
I'm using [Fsharp.UMX](https://github.com/fsprojects/FSharp.UMX) everywhere I can to make primitives typesafe, so I use it like
`type SequenceId = int64`
However when I face the need of using Interlocked methods I can't normally use measures
```
let mutable seqId = %0L
let x = Interlocked.Read(&seqId) // doesn't work
```
**Describe the solution you'd like**
I'd like it to just work, e.g. implicit type conversion made and result casted back to measure
**Describe alternatives you've considered**
There is a hacky way around provided by @Szer, which I won't use in code and rather stay without measures:
```
open System.Threading
open FSharp.UMX
open Microsoft.FSharp.NativeInterop
[] type seqId
type Foo = { mutable SeqId: int }
let foo = { SeqId = %1 }
let bar() =
use natPtr = fixed &foo.SeqId
let voidPtr = NativePtr.toVoidPtr natPtr
let natPtr2 = NativePtr.ofVoidPtr voidPtr
let byRef = NativePtr.toByRef natPtr2
Interlocked.Increment(&byRef) |> ignore
()
```
**Additional context**
This [is the commit](https://github.com/fsharplang-ru/pulsar-client-dotnet/commit/b76b41e0d326676decaefc7780869595daa2a0bd) that I had to do to revert measure
Contributor guide
Assessment
This issue has not been assessed yet.