Comments (16)
Nice. Is this planned for F# 9 ?
from fsharp.
No, or I don't think so at least, we just came up with this, prompted by the other issue :)
from fsharp.
I don't understand. Do what?
from fsharp.
copy and update all fields I guess
from fsharp.
I don't understand. Do what?
We should codegen new records instantiations when all fields are getting updated instead of generating a warning
from fsharp.
Nice. Is this planned for F# 9 ?
It should be small enough so we can make it for 9
from fsharp.
I am still none the wiser. These are all exactly the same
let x y = { y with B = 1 }
let xx yy = { yy with A = yy.A; B = 1 }
let xxx yyy = { A = yyy.A; B = 1 }
The warning has nothing to do with codegen.
from fsharp.
@kerams You are right. Sorry for my earlier message.
Indeed codegen is ok, the warning is opt-in, and is ok as opt-in warning.
So there is really nothing to do.
from fsharp.
I am still none the wiser. These are all exactly the same
let x y = { y with B = 1 } let xx yy = { yy with A = yy.A; B = 1 } let xxx yyy = { A = yyy.A; B = 1 }The warning has nothing to do with codegen.
Right, and we will get rid of warning altogether and instead will codegen new record construction when we can successfully detect that it's updating all fields.
from fsharp.
Nice. Is this planned for F# 9 ?
Everything planned for F# 9 can be found in the project - https://github.com/orgs/dotnet/projects/126/views/40
We don't plan to change the list, we might shelve some items if something crucial will come in (blocking engineering work, bug fixes, blocking interop work).
from fsharp.
codegen new record construction when we can successfully detect that it's updating all fields.
As opposed to emitting what?
The warning exists to inform you about a potential (refactoring) pitfall. Whether you choose to heed it or not, the resulting assembly is the same.
from fsharp.
codegen new record construction when we can successfully detect that it's updating all fields.
As opposed to emitting what?
The warning exists to inform you about a potential (refactoring) pitfall. Whether you choose to heed it or not, the resulting assembly is the same.
I for some reason thought that it doesn't generate the ctor call, must've thought about how C# records were working w.r.t. their clone method.
Then I don't really understand existence of this warning in the compiler. Could've been an analyzer.
from fsharp.
I don't know, why is 'unused value' in the compiler? What's the guidance? Do you want to relegate all potential future warnings into analyzers? If not, what are the deciding factors?
from fsharp.
I don't know, why is 'unused value' in the compiler? What's the guidance? Do you want to relegate all potential future warnings into analyzers? If not, what are the deciding factors?
I suppose if we have good analyzers infrastructure in future, all of the additional checks should go there unless decided otherwise. It's always good to offload some work from compiler. I saw a bunch of legit uses of this particular feature, when people have records with one field, it's "Empty" instance, and they just do Empty with Id=134
. That's the reason we turned it off.
from fsharp.
I don't know, why is 'unused value' in the compiler? What's the guidance? Do you want to relegate all potential future warnings into analyzers? If not, what are the deciding factors?
I suppose if we have good analyzers infrastructure in future, all of the additional checks should go there unless decided otherwise. It's always good to offload some work from compiler. I saw a bunch of legit uses of this particular feature, when people have records with one field, it's "Empty" instance, and they just do
Empty with Id=134
. That's the reason we turned it off.
As someone who contributes a lot of error reporting. I think is important to get a proper guidance here. Personally I would not want of the Analysers to be the “new compiler”
from fsharp.
I don't know, why is 'unused value' in the compiler? What's the guidance? Do you want to relegate all potential future warnings into analyzers? If not, what are the deciding factors?
I suppose if we have good analyzers infrastructure in future, all of the additional checks should go there unless decided otherwise. It's always good to offload some work from compiler. I saw a bunch of legit uses of this particular feature, when people have records with one field, it's "Empty" instance, and they just do
Empty with Id=134
. That's the reason we turned it off.As someone who contributes a lot of error reporting. I think is important to get a proper guidance here. Personally I would not want of the Analysers to be the “new compiler”
Any additional analysis which can be done outside of compiler, should be done outside of compiler (when and if we have infrastructure for it). Compiler should ideally only do typechecking and, well, compilation. Any additional analysis will be slowing things down.
from fsharp.
Related Issues (20)
- Impossible viable fork HOT 14
- Compiler allows non-functions to be bound to active pattern names HOT 4
- Consider deprecating desktop framework version of the F# compiler and FSI program HOT 6
- [Automated] PRs inserted in VS build feature.debugger.main-34920.221
- `MultipleDiagnosticsLoggers.Parallel` deadlock HOT 1
- Allow #nowarn to support the FS prefix on error codes to disable warnings HOT 2
- dotnet fsi crashes with lines longer than terminal width HOT 4
- Inline warning resulting in run time error (NotSupportedException) HOT 2
- An F# or C# shebang executable should use a cached binary on subsequent runs HOT 1
- F# files moved with by dragging HOT 1
- Enable F# Code Metrics and Analysis
- Improve onhover tooltip for visual studio HOT 1
- Support / fix replacing reference (Refactor -> Rename) of F# operator HOT 1
- [Feature request] Support solution view where projects are ordered based on number of dependent projects. HOT 2
- F# - Add Function Dependency Status to Functions/IntelliSense for F# (like C# has) HOT 1
- Internal error when dotting into delegate with 2 or more type parameters
- I'm getting unwanted navigation when holding `Ctrl` and hovering over operators like `&&` or `>`. Not sure if caused by this PR or a bug in VS. HOT 5
- Incorrect TailCall warning on async recursive functions HOT 2
- Allow #ParsedHashDirectives to have argument types other than strings HOT 1
- Provide better github.dev links for updating release notes HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fsharp.