{"action":"created","issue":{"url":"https://api.github.com/repos/Microsoft/visualfsharp/issues/13","labels_url":"https://api.github.com/repos/Microsoft/visualfsharp/issues/13/labels{/name}","comments_url":"https://api.github.com/repos/Microsoft/visualfsharp/issues/13/comments","events_url":"https://api.github.com/repos/Microsoft/visualfsharp/issues/13/events","html_url":"https://github.com/Microsoft/visualfsharp/pull/13","id":54297077,"number":13,"title":"Nameof operator","user":{"login":"forki","id":57396,"avatar_url":"https://avatars.githubusercontent.com/u/57396?v=3","gravatar_id":"","url":"https://api.github.com/users/forki","html_url":"https://github.com/forki","followers_url":"https://api.github.com/users/forki/followers","following_url":"https://api.github.com/users/forki/following{/other_user}","gists_url":"https://api.github.com/users/forki/gists{/gist_id}","starred_url":"https://api.github.com/users/forki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/forki/subscriptions","organizations_url":"https://api.github.com/users/forki/orgs","repos_url":"https://api.github.com/users/forki/repos","events_url":"https://api.github.com/users/forki/events{/privacy}","received_events_url":"https://api.github.com/users/forki/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-01-14T08:47:03Z","updated_at":"2015-01-16T20:45:13Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/Microsoft/visualfsharp/pulls/13","html_url":"https://github.com/Microsoft/visualfsharp/pull/13","diff_url":"https://github.com/Microsoft/visualfsharp/pull/13.diff","patch_url":"https://github.com/Microsoft/visualfsharp/pull/13.patch"},"body":"ThispPull request was moved from https://visualfsharp.codeplex.com/SourceControl/network/forks/forki/fsharp/contribution/7698 (see discussion there)\r\n\r\nhttps://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.\r\n\r\nThis feature was \"approved in principle\" by Don.\r\n\r\nSmall outline:\r\n* I added a nameof to env.fs\r\n* In opt.fs we rewrite the typed AST to const string expressions with the name\r\n* In check.fs we raise compiler errors for all unknown cases\r\n* prim-types.fs shows we will throw if we couldn't inline the nameof operator\r\n* src/fsharp/FSharp.Core.Unittests/NameOfTests.fs contains samples for all the known cases\r\n\r\nOpen questions:\r\n* How can we write unittests for the cases we don't want to support?\r\n  * I'd like to write a test which shows tha \"nameof(6)\" fails with compiler error\r\n* The C# spec for nameof shows cases that retrieve names for types. Do we want this too?\r\n* ...   \r\n\r\nRelated information:\r\n\r\nC#/VB spec for nameof: https://roslyn.codeplex.com/discussions/570551\r\nMads showing the nameof operator: http://channel9.msdn.com/Events/Visual-Studio/Connect-event-2014/116 (at 5:35)\r\n\r\n>> 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."},"comment":{"url":"https://api.github.com/repos/Microsoft/visualfsharp/issues/comments/70319334","html_url":"https://github.com/Microsoft/visualfsharp/pull/13#issuecomment-70319334","issue_url":"https://api.github.com/repos/Microsoft/visualfsharp/issues/13","id":70319334,"user":{"login":"ctaggart","id":80104,"avatar_url":"https://avatars.githubusercontent.com/u/80104?v=3","gravatar_id":"","url":"https://api.github.com/users/ctaggart","html_url":"https://github.com/ctaggart","followers_url":"https://api.github.com/users/ctaggart/followers","following_url":"https://api.github.com/users/ctaggart/following{/other_user}","gists_url":"https://api.github.com/users/ctaggart/gists{/gist_id}","starred_url":"https://api.github.com/users/ctaggart/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ctaggart/subscriptions","organizations_url":"https://api.github.com/users/ctaggart/orgs","repos_url":"https://api.github.com/users/ctaggart/repos","events_url":"https://api.github.com/users/ctaggart/events{/privacy}","received_events_url":"https://api.github.com/users/ctaggart/received_events","type":"User","site_admin":false},"created_at":"2015-01-16T20:45:13Z","updated_at":"2015-01-16T20:45:13Z","body":"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."}}