I propose we allow:
type C(?a) =
let b = defaultValueArg a 2 // Error here
member _.B = b
error FS0001: This expression was expected to have type
''a voption'
but here has type
''b option'
The existing way of approaching this problem in F# is using reference options.
Pros and Cons
The advantages of making this adjustment to F# are
- More structs, less GC pressure
- Allows for more optimisation
- In line with recent changes to allow ValueOptions to be used as active pattern return types
The disadvantage of making this adjustment to F# is that existing code ?a will have another potential type for all of us to learn about.
Extra information
Estimated cost (XS, S, M, L, XL, XXL): S
Related suggestions: all are ValueOption parity features.
Affidavit (please submit!)
Please tick this by placing a cross in the box:
Please tick all that apply:
For Readers
If you would like to see this issue implemented, please click the 👍 emoji on this issue. These counts are used to generally order the suggestions by engagement.
I propose we allow:
The existing way of approaching this problem in F# is using reference options.
Pros and Cons
The advantages of making this adjustment to F# are
The disadvantage of making this adjustment to F# is that existing code
?awill have another potential type for all of us to learn about.Extra information
Estimated cost (XS, S, M, L, XL, XXL): S
Related suggestions: all are ValueOption parity features.
Affidavit (please submit!)
Please tick this by placing a cross in the box:
Please tick all that apply:
For Readers
If you would like to see this issue implemented, please click the 👍 emoji on this issue. These counts are used to generally order the suggestions by engagement.