-
Notifications
You must be signed in to change notification settings - Fork 803
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
Consider '_' for members with access modifiers #7631
Conversation
I would need to add a test for this (it works on my machine) but I see that the tests I did (actually I modified existing ones) in the original PR are not here anymore, I couldn't find what happened, wanted to see if they were reverted but they simply disappeared from the history. |
I looked through the history and I have no idea what happened to the original single underscore PR. It was merged into To unblock you I've cherry-picked that PR into |
Could we maybe avoid merging such features/fixes to branches other than |
Now that the langversion switches are generally available, yes, that's the plan. If it helps we generally try to add stuff only to Part of the reason we couldn't do this in |
Quick update: Look at this comment for more context, but in short, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this PR, I like it, however, we missed the boat on including in FSharp4.7. This needs to target a new language version. FSharp5.0
Because FSharp 4.7 has already shipped, the feature will need to be isolated so that compiling --langversion:FSharp4.7 will still fail.
Testing should be updated so that compiling FSharp4.7 produces an error message consistent with what appeared before.
E.g:
1>C:\Users\kevinr\source\repos\ConsoleApp62\ConsoleApp62\Program.fs(13,20): error FS0010: Unexpected symbol '_' in member definition. Expected identifier, '(', '(*)' or other token.
1>C:\Users\kevinr\source\repos\ConsoleApp62\ConsoleApp62\Program.fs(19,27): error FS0010: Unexpected symbol '_' in member definition. Expected identifier, '(', '(*)' or other token.
```
Thanks for this PR, I like it.
@KevinRansom I disagree with this going into F# 5, it's clearly a cleanup of an existing feature which doesn't really warrant F# 5 |
@KevinRansom I think the new language switch is a nice feature, but we don't have to abuse of it and treat every single change/addition as a separate feature. At some point we have to look for a compromise. In this case I think it's easy, as already described by @cartermp . Also note that this is not a breaking change. |
@gusty, it's not an abuse. The purpose of the switch is to allow a developer working in an environment with mixed language versions to pick a maximum language version to compile with. If we add additional language features following the release of a specific language version then the initial versions of that compiler version won't work to compile the code. From a grab the latest version of the language tools, we find that people fall into two groups.
Someone in group 1 would not be able to build code from someone in group2 that relied on this new language feature. Please note: this is a new language feature not a bug. |
I see what you mean, but that's taking it to the extreme and not considering updates. Now, it's true that from the pure technical viewpoint this is an additional feature, but from the conceptual view this is a bug, something we (and the final user) assumed the 4.7 version was going to handle but @pauldorehill just found out that surprisingly it didn't. So, this is clearly a bug conceptually speaking, the behavior is unexpected and there is no logical reason to forbid |
@KevinRansom This is a bug fix, not a new feature. Not everything related to language features has to go under a flag. |
@cartermp And with and without the fix will the compiler generate code both times? or will it fail with an error when compiling the same FSharp 4.7 code on one of the compilers? To be clear … the compiler works as intended in FSharp4.7 today. This PR relaxes a restriction imposed by the compiler. |
This is no different than any other bug fix or feature improvement where a compile error with an older compiler doesn't exist on a newer one. This is not something that needs to go under LangVersion. We shouldn't stuff anything language-related under it just because we have it. |
We used to add new language features throughout the point release cycle, Whereby F#4.7 is the version of the language as it exists in the final point release? Is that still the plan? |
This is not a new language feature. This is a small augmentation to an existing language feature (and arguably a bug since the error violates user expectations, and fixing it doesn't break anything). |
Standing aside from my position I find this discussion interesting. Back to my position and trying to reconcile with Kevin's initial statement:
I would amend it like this:
Someone in group 1 would not be able to build code from someone in group2 that relied on this new language feature, if he missed updates |
@Gustavo Guerra
I believe that our metadata shows a chunk of people stay on RTM without applying updates, although a bigger chunk apply updates. I believe there is hardly any that mix it up and take some updates, E.g. 2019.2 and stop there. I’m not certain what happens with the dotnet cli installs that are separate from VS, I imagine they never get updated, until the developer remembers and updates manually. But that is just my feeling, I have no data available one way or another.
Regardless, code may be compiled by FSharp4.7 compilers without this “bug fix”. Labelling this source code incompatibility “a bug fix” will enable us to provoke this outcome.
Kevin
|
Yes, as I understand it this is a fix to the 4.7 feature. |
In the VS 2017 cycle C# shipped a point release of the language with an update. Would that make sense here? Add a new langversion 4.7.1 and ship it with VS 2019.4 (or whichever version this will be merged)? |
We're not planning on a version between now and F# 5 (certainly not for this). |
Just as a point of clarification: since this is being viewed as a bug fix, there's no rev to the F# language going to be involved. |
* Consider '_' for members with access modifiers * Add tests * Revert * Add tests with modifiers
This will allow the use of the '_' for members with access modifiers like: