-
Notifications
You must be signed in to change notification settings - Fork 790
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
Don't suggest using mutable keyword for parameters #15803
Comments
Instead it could suggest to redefine the |
@Happypig375 mhm this would be compilable code indeed, I just wonder if there can really be a valid use case for that - as in, any real world code where you would recommend a developer such an approach instead of e.g. refactoring code to remove mutables :) |
Yeah I think I would be cautious with the word "consider" and be more like "if you for some weird reason intended to ... then ..." :) But yeah, that's details, more important it should be just a different diag/message. |
Yes, when you want to make defensive copy. |
Using a |
Suggesting making the parameter mutable is more hostile to beginners than it is helpful to experienced F# devs. We can acknowledge that a new binding would solve the issue as most people who run across this issue are learning F# for the first time, do not need to mutate it, and there may be a good reason their teammates made it immutable in the first place 😃 .
This way, it doesn't actively encourage a mutable copy when most beginners learning the language probably would have an easier time with a new immutable variable. |
This is misleading:
The error is okay I think, we just shouldn't suggest making parameters mutable, this is illegal.
The text was updated successfully, but these errors were encountered: