Closed TMVector closed 2 years ago
I think the place for this is FSHarpLint. FSharpLint warnings are active by default in editors such as VSCode/Ionide so have a strong affect on the usage of the langugae
Closing as I don't see a general criteria for this in the language. Linting is possible
I propose the compiler should produce a warning when it is likely the programmer has confused the inline getter syntax for setting the intial value.
For example, consider the following class:
An unexperienced fsharper (like me) could very easily confuse
member _
withmember val _
, and the result will be very confusing behaviour. When the programmer attempts to add an entry to dict2, they will be frustrated to find nothing works.I think the easiest/cleanest solution is for the compiler to issue a warning when this syntax is used, and the getter body is an object creation expression not of record or tuple type.
I tentatively propose the following warning message:
Pros and Cons
The advantages of making this adjustment to F# are:
The disadvantages of making this adjustment to F# are:
Extra informtion
Estimated cost (XS, S, M, L, XL, XXL): S?
Affadavit (must be submitted)
Please tick this by placing a cross in the box:
Please tick all that apply: