You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'd like to have checks on F# code that reports DUs and exceptions for which the fields are left unammed.
typeDU=| Case1 ofint// kind of ok| Case2 ofok:int*okok:string// ok| Case3 ofint*noOkCase:string// kind of not okexception Exception1 ofint// kind of okexception Exception2 ofok:int*okok:string// okexception Exception3 ofint*noOkCase:string// kind of not ok
In exchange with @baronfel, it came that FCS is good place for such helper function to be defined, and scaffolding from there, have other tools (IDE, linters, code fixes, etc.) using it.
There is an aspect of this concern which I think could contribute to the F# guidelines around authoring of DUs and exceptions.
If there is appeal for this, I thought of those relaxations:
type is not public
type is defined in a script
there is a single field
I'm considering an extra one, if the type of the fields are all distinct, despite I don't think it is the best, if we'd bring this to the F# guidelines.
Is your feature request related to a problem? Please describe.
I find it problematic in debug scenarios for cases with many fields, also I'm sad that the implementation for #1885 doesn't pop up everywhere it would be useful, if only we nudged DU / exception authors, to name the fields.
Describe the solution you'd like
I'm willing to work on implementation of such helper function in FCS API, and depending where we want to take it, look at places I could put it in practice (say a code fixer, if we have infrastructure that would suggest member names).
Describe alternatives you've considered
Remain oblivious to the presence of unnamed fields, and see less usage for #1885
The text was updated successfully, but these errors were encountered:
@vzarytovskii thanks. I am all down for taking this wherever I'm nudged towards, especially if I can get a bit of coaching / pointers on how we want this shaped, from FCS or any other standpoint.
My end goal is basically to discourage unnamed fields in our F# guidelines, if this gets a consensus.
I'd like to have checks on F# code that reports DUs and exceptions for which the fields are left unammed.
In exchange with @baronfel, it came that FCS is good place for such helper function to be defined, and scaffolding from there, have other tools (IDE, linters, code fixes, etc.) using it.
There is an aspect of this concern which I think could contribute to the F# guidelines around authoring of DUs and exceptions.
If there is appeal for this, I thought of those relaxations:
I'm considering an extra one, if the type of the fields are all distinct, despite I don't think it is the best, if we'd bring this to the F# guidelines.
Is your feature request related to a problem? Please describe.
I find it problematic in debug scenarios for cases with many fields, also I'm sad that the implementation for #1885 doesn't pop up everywhere it would be useful, if only we nudged DU / exception authors, to name the fields.
Describe the solution you'd like
I'm willing to work on implementation of such helper function in FCS API, and depending where we want to take it, look at places I could put it in practice (say a code fixer, if we have infrastructure that would suggest member names).
Describe alternatives you've considered
Remain oblivious to the presence of unnamed fields, and see less usage for #1885
The text was updated successfully, but these errors were encountered: