-
Notifications
You must be signed in to change notification settings - Fork 830
WIP: Nameof operator #13
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
Conversation
|
Thanks for moving this over Steffen. From: Steffen Forkmann [mailto:[email protected]] ThispPull request was moved from https://visualfsharp.codeplex.com/SourceControl/network/forks/forki/fsharp/contribution/7698 (see discussion there) https://fslang.uservoice.com/forums/245727-f-language/suggestions/5900625-add-nameof-operator-to-follow-c-vb-update suggests we implement a "nameof" operator which is something similar to the typeof operator. This feature was "approved in principle" by Don. Small outline:
Open questions:
Related information: C#/VB spec for nameof: https://roslyn.codeplex.com/discussions/570551 Latkin: F# 4.0 triage – This PR is not being considered for F# 4.0, but will be left open for the time being to allow for community feedback. You can merge this Pull Request by running git pull https://github.com/forki/visualfsharp nameof Or view, comment on, or merge it at: Commit Summary
File Changes
Patch Links:
— |
|
Looking forward to this functionality being added at some point. I think it will be a great addition. I could really use it for some logging I'm doing right now. |
|
Could you please describe your scenario with a small code sample? |
|
This won't be in F# 4.0, and needs further work, so I suggest we "archive" this PR for now by closing it, and then revisiting it later. |
|
Could you add some sort of labels e.g. "archived", "deferred", etc. so that it is easier to track these issues? |
|
Yes, we would need an "archived" label. The feature is still in http://fslang.uservoice.com of course, which sort of acts as a root for all future feature work on the core language/library |
|
(just a small technical note: the branch should be kept in at least one repo, otherwise it might get lost after closing) |
|
"archived" it is |
|
What is the status of this feature? |
|
I created a prototype, but there are many open edge cases.
|
|
Look forward to this feature. I assume it will work also doing interop with C# code. |
|
Example usecase: let fooType = foo.GetType().DeclaringType.GetMethod(nameof(foo)) |
|
@bluemmc yes there are many usecases, but team decided against it for now. |
|
Yes, could read that it would not make it for F# 4.0 - but that is out now. What about next F# versions - has that been decided ? |
|
@KevinRansom @otawfik-ms @NumberByColors ? |
|
Would of been nice to have the open edge cases listed so that anyone interested could look at them etc. |
|
Unfortunately I can't reopen this after @latkin closed it. IIRC we had some discussion over there. It was mostly that we don't support all the positions where nameof can be used in C# (e.g. in attributes) |
|
From the discussion here you can tell that the interest inside ms is rather low ;-) |
|
Yes, unfortunately no response from the F# team. Nameof is the one of few place where C# has a strong advantage language-wise. It is highly annoying that F# still forces developers to use a string anti-pattern when referencing stuff. @dsyme Is it possible to clarify if there are any plans for Nameof support in F# ? |
|
well, i think this pr it's dead (need rebase anyway). It's a really nice feature to have, and a good base implementation by @forki |
|
Ok I will try to rebase. Then we can let it rot again. |
@forki Would be better to release something a partial fix, rather then letting it rot as you write. Hopefully the F# team can see the benefits of your contribution after a rebase and another look? |
|
i really hope not @forki, it's a really nice feature. |
|
rebased version at #908 |
merge from master
append extension methods in GetRelevantMethodsForTrait
This pull request was moved from https://visualfsharp.codeplex.com/SourceControl/network/forks/forki/fsharp/contribution/7698 (see discussion there)
https://fslang.uservoice.com/forums/245727-f-language/suggestions/5900625-add-nameof-operator-to-follow-c-vb-update suggests we implement a "nameof" operator which is something similar to the typeof operator.
This feature was "approved in principle" by Don.
Small outline:
Open questions:
Related information:
C#/VB spec for nameof: https://roslyn.codeplex.com/discussions/570551
Mads showing the nameof operator: http://channel9.msdn.com/Events/Visual-Studio/Connect-event-2014/116 (at 5:35)