Uh oh!
There was an error while loading. Please reload this page.
[WIP] [FS-1003] Nameof operator reimplementation - #2290
[WIP] [FS-1003] Nameof operator reimplementation#2290vasily-kirichenko wants to merge 34 commits into
Conversation
Conflicts: src/fsharp/FSComp.txt src/fsharp/FSharp.Core.Unittests/SurfaceArea.Silverlight.2.0.fs src/fsharp/FSharp.Core.Unittests/SurfaceArea.net20.fs src/fsharp/PostInferenceChecks.fs src/fsharp/TastOps.fs src/fsharp/TcGlobals.fs
This reverts commit 529cc6f.
This reverts commit 223d313. Conflicts: tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfAdditionExpr.fs tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfAppliedFunction.fs tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfAsAFunction.fs tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfDictLookup.fs tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfIntConst.fs tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfIntegerAppliedFunction.fs tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfParameterAppliedFunction.fs tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfPartiallyAppliedFunction.fs tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfStringConst.fs tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfWithPipe.fs
forki
commented
Jan 18, 2017
This looks promising. Please keep us posted about progress. |
| | SynExpr.LongIdent(_, LongIdentWithDots(idents, _), _, _) when not (isNil idents) -> | ||
| match expr with | ||
| // `nameof` operator | ||
| | ApplicableExpr (_, Expr.App(Expr.Const(Const.String("nameof"), _, _), _, _, _, _), _) -> // no idea really what shape we should match on here, will check in debugger |
There was a problem hiding this comment.
this is technically a breaking change when user-defined function nameof exists in the scope. I think it should resolve the name and only treat it as nameof operator if it it was resolved to intrinsic from FSharp.Core
There was a problem hiding this comment.
@vladima thanks! Any point how to do it? :)
There was a problem hiding this comment.
@vladima I think I've found out the solution.
vasily-kirichenko
commented
Jan 18, 2017
|
forki
commented
Jan 18, 2017
❤️ |
saul
commented
Jan 18, 2017
This is really cool :) |
forki
commented
Jan 19, 2017
Yeah looks much better than my original implementation. Next step would be tests for doing this in attributes. |
it raises a proper error if applicated to non (Long)Ident arg
vasily-kirichenko
commented
Jan 19, 2017
@forki looks like it already works in attributes: I haven't checked the generated IL though. |
@vasily-kirichenko, what is the value of |
vasily-kirichenko
commented
Jan 19, 2017
@smoothdeveloper no, it returns "foo". I think that's how it's supposed to work. |
smoothdeveloper
commented
Jan 19, 2017
That will give some surprise for those doing reflection, but yes I agree it is expected behaviour. We will need |
vasily-kirichenko
commented
Jan 19, 2017
The problem: currently we can use
So we should restrict places where |
vasily-kirichenko
commented
Jan 19, 2017
The above's been fixed. |
vasily-kirichenko
commented
Jan 19, 2017
All cases from the list at the bottom of the RFC https://github.com/fsharp/fslang-design/blob/master/RFCs/FS-1003-nameof-operator.md work, except the following two:
I don't think we should support the last case at all. @dsyme any points where to fix the case with pattern matching? I think it's quite important. |
dsyme
commented
Jan 19, 2017
(I'm going to hold off reviewing this and the RFC until VS20117 RTM is done and dusted if that's ok) |
abelbraaksma
commented
Sep 23, 2017
@vasily-kirichenko, well, it would have been an easy resolution for what I recently encountered with running certain tests, see #3632, but I'd understand, one swallow doesn't make it Spring (Dutch proverb ;)). |
ReedCopsey
commented
Sep 23, 2017
@vasily-kirichenko That's just not true - many users (including myself) would love for this to be implemented. It's very useful in certain types of applications. |
realvictorprm
commented
Sep 23, 2017
I consider this to be fundamental. Therefor I think there isn't any argument against implementing it. |
@realvictorprm, I think that this PR was close to being finished by @vasily-kirichenko. I'd be interested to understand the current limitations better and why they aren't resolvable (could someone elaborate with an example perhaps?), or whether we can live with those limitations (F# has more limitations when it comes to full support of whatever C# can do). Sometimes covering 99% of all common cases is good enough, even more so if the other 1% can be worked around. Besides, it would be a waste to see all this work gone for naught. |
forki
commented
Sep 24, 2017
Look @vasily-kirichenko and myself tried to get it in (#13 and #908). It looks like super trivial feature but it has many many edge cases. What it needs is someone who goes through all the cases and makes a list which shows what is implemented and what not. Then @dsyme can decide if it is enough |
forki
commented
Sep 24, 2017
(first version is over two years old) |
dsyme
commented
Sep 25, 2017
This is not true
This is true |
KevinRansom
commented
Sep 12, 2018
@dsyme, @cartermp, @vasily-kirichenko, I'm trying to cut down the number of inactive PR's on our repo. This seems to be quite dead. I think the best thing is to close it, and let someone emerge who wants this feature drive it to completion. It has hung around without a concerted efforted for about 3 years now. What do you think? Kevin |
vasily-kirichenko
commented
Sep 12, 2018
So, Microsoft does not want to drive it? Why it wanted to drive the Span feature, but does not want to do this one? Who decides? |
KevinRansom
commented
Sep 12, 2018
the span feature priority is irrelevant to this discussion. |
vasily-kirichenko
commented
Sep 12, 2018
I could close this PR, as I did before, but you guys love to reopen it, so feel free to close it yourself. |
KevinRansom
commented
Sep 12, 2018
Okay I am closing this PR. I have created a branch: |
xperiandri
commented
Feb 18, 2019
Is this feature complete? |
slang25
commented
Feb 18, 2019
@xperiandri No, it needs reviving, rebasing, and taking over the finish line. There's a venn diagram of
and it's a slim intersection I believe. |
This comment has been minimized.
This comment has been minimized.
cartermp
commented
Feb 18, 2019
From a technical standpoint, the remaining work here is to handle:
|
dsyme
commented
Mar 12, 2019
Revamped implementation at #6325 @vasily-kirichenko@forki Thank you for your work on this RFC so far. |




Implementation of RFC FS-1003