{"action":"created","issue":{"url":"https://api.github.com/repos/dotnet/roslyn/issues/10624","repository_url":"https://api.github.com/repos/dotnet/roslyn","labels_url":"https://api.github.com/repos/dotnet/roslyn/issues/10624/labels{/name}","comments_url":"https://api.github.com/repos/dotnet/roslyn/issues/10624/comments","events_url":"https://api.github.com/repos/dotnet/roslyn/issues/10624/events","html_url":"https://github.com/dotnet/roslyn/issues/10624","id":148761412,"number":10624,"title":"let statement may break compatibility with a user-defined type named let","user":{"login":"gafter","id":3804346,"avatar_url":"https://avatars.githubusercontent.com/u/3804346?v=3","gravatar_id":"","url":"https://api.github.com/users/gafter","html_url":"https://github.com/gafter","followers_url":"https://api.github.com/users/gafter/followers","following_url":"https://api.github.com/users/gafter/following{/other_user}","gists_url":"https://api.github.com/users/gafter/gists{/gist_id}","starred_url":"https://api.github.com/users/gafter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gafter/subscriptions","organizations_url":"https://api.github.com/users/gafter/orgs","repos_url":"https://api.github.com/users/gafter/repos","events_url":"https://api.github.com/users/gafter/events{/privacy}","received_events_url":"https://api.github.com/users/gafter/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/dotnet/roslyn/labels/Area-Language%20Design","name":"Area-Language Design","color":"5319e7"},{"url":"https://api.github.com/repos/dotnet/roslyn/labels/Language-C%23","name":"Language-C#","color":"207de5"},{"url":"https://api.github.com/repos/dotnet/roslyn/labels/New%20Language%20Feature%20-%20Pattern%20Matching","name":"New Language Feature - Pattern Matching","color":"bfd4f2"},{"url":"https://api.github.com/repos/dotnet/roslyn/labels/Tenet-Compatibility","name":"Tenet-Compatibility","color":"eb6420"}],"state":"open","locked":false,"assignee":{"login":"gafter","id":3804346,"avatar_url":"https://avatars.githubusercontent.com/u/3804346?v=3","gravatar_id":"","url":"https://api.github.com/users/gafter","html_url":"https://github.com/gafter","followers_url":"https://api.github.com/users/gafter/followers","following_url":"https://api.github.com/users/gafter/following{/other_user}","gists_url":"https://api.github.com/users/gafter/gists{/gist_id}","starred_url":"https://api.github.com/users/gafter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gafter/subscriptions","organizations_url":"https://api.github.com/users/gafter/orgs","repos_url":"https://api.github.com/users/gafter/repos","events_url":"https://api.github.com/users/gafter/events{/privacy}","received_events_url":"https://api.github.com/users/gafter/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/dotnet/roslyn/milestones/15","html_url":"https://github.com/dotnet/roslyn/milestones/2.0%20(RC)","labels_url":"https://api.github.com/repos/dotnet/roslyn/milestones/15/labels","id":1571383,"number":15,"title":"2.0 (RC)","description":"","creator":{"login":"davkean","id":1103906,"avatar_url":"https://avatars.githubusercontent.com/u/1103906?v=3","gravatar_id":"","url":"https://api.github.com/users/davkean","html_url":"https://github.com/davkean","followers_url":"https://api.github.com/users/davkean/followers","following_url":"https://api.github.com/users/davkean/following{/other_user}","gists_url":"https://api.github.com/users/davkean/gists{/gist_id}","starred_url":"https://api.github.com/users/davkean/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davkean/subscriptions","organizations_url":"https://api.github.com/users/davkean/orgs","repos_url":"https://api.github.com/users/davkean/repos","events_url":"https://api.github.com/users/davkean/events{/privacy}","received_events_url":"https://api.github.com/users/davkean/received_events","type":"User","site_admin":false},"open_issues":245,"closed_issues":53,"state":"open","created_at":"2016-02-08T21:53:59Z","updated_at":"2016-04-20T00:13:13Z","due_on":null,"closed_at":null},"comments":8,"created_at":"2016-04-15T20:29:06Z","updated_at":"2016-04-20T12:16:02Z","closed_at":null,"body":"The parser doesn't know whether or not there is a user-defined type named `let`, so it parses a `let` statement assuming that no such type exists. As a practical matter than would break existing code that uses `let` as the name of a type. Do we want to do anything about this?"},"comment":{"url":"https://api.github.com/repos/dotnet/roslyn/issues/comments/212401863","html_url":"https://github.com/dotnet/roslyn/issues/10624#issuecomment-212401863","issue_url":"https://api.github.com/repos/dotnet/roslyn/issues/10624","id":212401863,"user":{"login":"alrz","id":3105979,"avatar_url":"https://avatars.githubusercontent.com/u/3105979?v=3","gravatar_id":"","url":"https://api.github.com/users/alrz","html_url":"https://github.com/alrz","followers_url":"https://api.github.com/users/alrz/followers","following_url":"https://api.github.com/users/alrz/following{/other_user}","gists_url":"https://api.github.com/users/alrz/gists{/gist_id}","starred_url":"https://api.github.com/users/alrz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alrz/subscriptions","organizations_url":"https://api.github.com/users/alrz/orgs","repos_url":"https://api.github.com/users/alrz/repos","events_url":"https://api.github.com/users/alrz/events{/privacy}","received_events_url":"https://api.github.com/users/alrz/received_events","type":"User","site_admin":false},"created_at":"2016-04-20T12:16:01Z","updated_at":"2016-04-20T12:16:01Z","body":"\r\n\r\n\r\n\r\n\r\n>Patterns do not \"target-type\" the expression.\r\n\r\nSo I suppose this is not exactly a shortcut for #115, since the semantics are quite different.\r\n\r\n\r\n>>`let x = e1 when x > 0 else return;`\r\n\r\n>Yes.\r\n\r\nAccording to the latest spec (#10644) it's not. But the following is,\r\n```cs\r\nlet var x = e1 when x > 0 else return;\r\n```\r\nIsn't this considered as inconsistent?\r\n\r\nIf this is intended to work, perhaps `let` syntax should be merged with local declarations, meaning that the parser would always expect `when` and `else` clauses.\r\n\r\n>there is only one pattern-match in the syntax.\r\n\r\nMore to the point of this issue, right now `let x = e1, y = e2;` is legal as long as we have a type named `let`, right? I don't see why it should not be otherwise when we do have a `let` statement. I'm trying to say that this code *is* and *will be* syntactically correct. It'd be unfortunate for it to not work even if we had`let` statements in the language. It would be a good alternative to #5048 specially because `let` is not a placeholder for a *type* so allowing something like `let x = 1.0, y = 1;` would not nullify this fact.\r\n\r\n\r\n\r\n\r\n\r\n> I have no idea what that let in the middle means.\r\n\r\n\r\n\r\nThat would be a shortcut for multiple pattern deconstructions with a single `else` clause.\r\n```cs\r\nlet Point(1, var y) = e1 // when ..\r\nlet Point(var x, 1) = e2 // when ..\r\nelse return new Exception(...);\r\n```\r\nOtherwise you'd need to duplicate the `else` part.\r\n"}}