Extend fixed expressions to Span, Memory, refs, and GetPinnableReference
There should be some way to pin instances of Span, Memory, and certain kinds of types to take their native addresses for native interop purposes. In C# you can just use the fixed statement, but F# only supports a limited set of constructs, none of which you can get to work with Spans.
This can all be accomplished in F# by making fixed expressions work with anything that implements GetPinnableReference() just like C#.
Pros and Cons
Advantages:
- You can use spans in native interop situations without being forced to copy it to an array first
- Feature parity with C#
Disadvantages:
- It's work
- More special language rules
Extra information
Estimated cost (XS, S, M, L, XL, XXL): M? Just a guess.
Related suggestions: (put links to related suggestions here)
Affidavit (please submit!)
Please tick this by placing a cross in the box:
Please tick all that apply:
Extend fixed expressions to Span, Memory, refs, and GetPinnableReference
There should be some way to pin instances of Span, Memory, and certain kinds of types to take their native addresses for native interop purposes. In C# you can just use the
fixedstatement, but F# only supports a limited set of constructs, none of which you can get to work with Spans.This can all be accomplished in F# by making
fixedexpressions work with anything that implementsGetPinnableReference()just like C#.Pros and Cons
Advantages:
Disadvantages:
Extra information
Estimated cost (XS, S, M, L, XL, XXL): M? Just a guess.
Related suggestions: (put links to related suggestions here)
Affidavit (please submit!)
Please tick this by placing a cross in the box:
Please tick all that apply: