{"action":"created","issue":{"url":"https://api.github.com/repos/dotnet/roslyn/issues/5445","labels_url":"https://api.github.com/repos/dotnet/roslyn/issues/5445/labels{/name}","comments_url":"https://api.github.com/repos/dotnet/roslyn/issues/5445/comments","events_url":"https://api.github.com/repos/dotnet/roslyn/issues/5445/events","html_url":"https://github.com/dotnet/roslyn/issues/5445","id":108347070,"number":5445,"title":"Proposal: Forward Pipe Operator","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},"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/Feature%20Request","name":"Feature Request","color":"fc2929"}],"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/8","html_url":"https://github.com/dotnet/roslyn/milestones/C%23%207%20and%20VB%2015","labels_url":"https://api.github.com/repos/dotnet/roslyn/milestones/8/labels","id":962632,"number":8,"title":"C# 7 and VB 15","description":"\r\n\r\n<!---\r\n@huboard:{\"order\":0.375}\r\n-->\r\n","creator":{"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},"open_issues":60,"closed_issues":10,"state":"open","created_at":"2015-02-02T23:41:34Z","updated_at":"2015-10-21T03:41:45Z","due_on":null,"closed_at":null},"comments":25,"created_at":"2015-09-25T15:24:52Z","updated_at":"2015-10-26T16:53:04Z","closed_at":null,"body":"When you are chaining multiple methods to one another you might end up with something like this:\r\n```C#\r\nConsole.WriteLine(BitConverter.ToString(SHA1.Create().ComputeHash(File.ReadAllBytes(Console.ReadLine()))));\r\n```\r\nUsing forward pipe operator it can be written as (in the same order that they will be executed):\r\n```C#\r\nConsole.ReadLine()\r\n:> File.ReadAllBytes\r\n:> SHA1.Create().ComputeHash\r\n:> BitConverter.ToString\r\n:> Console.WriteLine;\r\n```\r\nWe can take a step further and specify named args (similar to currying proposed in #3171):\r\n```C#\r\nConsole.ReadLine()\r\n:> File.ReadAllBytes\r\n:> SHA1.Create().ComputeHash\r\n:> BitConverter.ToString\r\n:> Console.WriteLine(format: \"SHA1: {0}\");\r\n```\r\n*EDIT:* Note that `format` here, is the first parameter, meaning that the value forwarded to the second parameter, which is natural for currying by definition, but this can be extended to support other parameters based on some rules — like forwarding to the best overload's unspecified parameter.\r\n\r\nThe syntax also plays nice with #5402:\r\n```\r\nConsole.ReadLine()\r\n:> File.ReadAllBytes\r\n:> SHA1.Create().ComputeHash\r\n:> bytes => foreach(var b in bytes): Console.Write($\"{b:x2}\");\r\n``` \r\nAnd as mentioned in #5206 and discussed in #347 we can use tuples to support methods with multiple parameters:\r\n```C#\r\ntuple :> dictionary.Add;\r\n```\r\nTo prevent ambiguity, I think this should be allowed only in this context.\r\n\r\n*EDIT:* Syntax updated."},"comment":{"url":"https://api.github.com/repos/dotnet/roslyn/issues/comments/151207094","html_url":"https://github.com/dotnet/roslyn/issues/5445#issuecomment-151207094","issue_url":"https://api.github.com/repos/dotnet/roslyn/issues/5445","id":151207094,"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":"2015-10-26T16:53:03Z","updated_at":"2015-10-26T16:53:03Z","body":"@gafter That sentence was very comforting. Thank God."}}