-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Give advisory messages when using ! and :=, and ask users to use .Value instead #569
Comments
Very much in favor of deprecating the If we do, sometime in the future, add But in the short term, I'm certainly in favor of deprecating the |
Slightly related, may I create a proposal to un-deprecate |
@0x53A You could try :) But yes, I would close that |
@rmunn one problem with "not" is the extra parenthesization induced, e.g. |
I am marking this as approved-in-principle, though an RFC might not get through the discussion process, e.g. as we get all input on backwards-compat issues |
‘not’ is composable, while there are some operators found in other ml languages that could make it easier. |
Can't |
I think depreciating |
I'm in favor if there is a mechanism to convert syntax from This can be done in VS by registering a code fix for a specific error message. Other editors would have to do a similar thing (cc @Krzysztof-Cieslak), thus the logic for rewriting the source would have to live in FCS. |
I think it depends on the perspective and where you are coming from. The majority of programmers use c-like languages where In python Though I know of c# developers that prefer to use If you are coming from another background where you have used more math, then My personal preference would be to be able to use both |
Pattern matching on value is quote nice to destructure ref cells anyway, I do wish that an Option had the capability to hold a reference going from None to Some much like a ref cell would hold a reference. |
Adding this suggested fix today would be great |
We'd need the warning first, or an analyzer system that Roslyn can understand. Right now we're locked into diagnostics-based quick fixes. It could also be a CodeRefactoringProvider I guess too, that would be worth looking into. |
I guess we could look for all symbols resolving to the FSharp.Core operator |
That isn't the issue. It's informing Roslyn's diagnostic-based system of quick fixes that there is a diagnostic we can listen to. You can't create custom document diagnostic analyzers right now, so there's no option to create this codefix today. The only option that may exist is a code refactoring provider. |
I see. Yes I hit this with the analyzer work and just added the analyzer diagnostics to the UnusedOpens diagnostic analyzer for now (which means unused opens won't show until all analyzers have run, and all analyzers must run before any of their diagnostics are shown). |
Should |
Not unless it were to change the reference cell into a local and change all update sites to be |
@cartermp |
Yes, we would recommend
|
My specific proposal is to give informational messages from compiler and IDE when using Informational messages are different to warnings because |
Completed in F# 6 |
As of F# 4.0,
let mutable x = ...
supports automatic promotion to a reference cell if thex
is captured in a closure. As a result, the explicit use ofref
cells is now far less common for F# programming.Because of this, I propose we gradually consider deprecating the default FSharp.Core definition of
and instead ask people to use
r.Value
insteadThis has two advantages
for programmers coming from most other languages,
!
already has a very specific meaning - usually boolean negation. For these people - and arguably others -r.Value
is clearerin the very, very long-term we could consider giving
!x
the usual meaning as an overloaded operator suitable for using with boolean values.The disadvantages are somewhat obvious: it is changing something stable and which works.
Extra information
Estimated cost (XS, S, M, L, XL, XXL): S, but large downstream costs
Affadavit (must be submitted)
Please tick this by placing a cross in the box:
Please tick all that apply:
The text was updated successfully, but these errors were encountered: