{"action":"created","issue":{"url":"https://api.github.com/repos/dotnet/roslyn/issues/11882","repository_url":"https://api.github.com/repos/dotnet/roslyn","labels_url":"https://api.github.com/repos/dotnet/roslyn/issues/11882/labels{/name}","comments_url":"https://api.github.com/repos/dotnet/roslyn/issues/11882/comments","events_url":"https://api.github.com/repos/dotnet/roslyn/issues/11882/events","html_url":"https://github.com/dotnet/roslyn/issues/11882","id":159323894,"number":11882,"title":"inline or sync keyword for function callback","user":{"login":"Thaina","id":1042507,"avatar_url":"https://avatars.githubusercontent.com/u/1042507?v=3","gravatar_id":"","url":"https://api.github.com/users/Thaina","html_url":"https://github.com/Thaina","followers_url":"https://api.github.com/users/Thaina/followers","following_url":"https://api.github.com/users/Thaina/following{/other_user}","gists_url":"https://api.github.com/users/Thaina/gists{/gist_id}","starred_url":"https://api.github.com/users/Thaina/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Thaina/subscriptions","organizations_url":"https://api.github.com/users/Thaina/orgs","repos_url":"https://api.github.com/users/Thaina/repos","events_url":"https://api.github.com/users/Thaina/events{/privacy}","received_events_url":"https://api.github.com/users/Thaina/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2016-06-09T04:00:20Z","updated_at":"2016-06-09T13:13:03Z","closed_at":null,"body":"async callback is powerful feature. But sometimes it overkill to enforce all callback pass in function\r\n\r\nFirst limitation is callback function cannot using ref parameter unless we copy it\r\n\r\nAnd Sometimes function is just iterator or little extension method that could and should be inlined both callback and the function itself\r\n\r\nSo I think we should have `inline` or `sync` keyword at least at function parameter. And the function written at callback could access ref parameter\r\n\r\n```C#\r\ninline void ForEach(this IEnumerable<T> items,inline Func<T,bool> callBack)\r\n{\r\n    foreach(var item in items)\r\n         callBack(item);\r\n}\r\n\r\nvoid Main(ref LargeStruct ls)\r\n{\r\n    [\"Setting0\",\"Setting1\",\"Setting2\"].ForEach(inline (key) {\r\n         ls.Set(key); // normally cannot access ref struct here\r\n    });\r\n}\r\n\r\n```"},"comment":{"url":"https://api.github.com/repos/dotnet/roslyn/issues/comments/224890098","html_url":"https://github.com/dotnet/roslyn/issues/11882#issuecomment-224890098","issue_url":"https://api.github.com/repos/dotnet/roslyn/issues/11882","id":224890098,"user":{"login":"svick","id":287848,"avatar_url":"https://avatars.githubusercontent.com/u/287848?v=3","gravatar_id":"","url":"https://api.github.com/users/svick","html_url":"https://github.com/svick","followers_url":"https://api.github.com/users/svick/followers","following_url":"https://api.github.com/users/svick/following{/other_user}","gists_url":"https://api.github.com/users/svick/gists{/gist_id}","starred_url":"https://api.github.com/users/svick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/svick/subscriptions","organizations_url":"https://api.github.com/users/svick/orgs","repos_url":"https://api.github.com/users/svick/repos","events_url":"https://api.github.com/users/svick/events{/privacy}","received_events_url":"https://api.github.com/users/svick/received_events","type":"User","site_admin":false},"created_at":"2016-06-09T13:13:03Z","updated_at":"2016-06-09T13:13:03Z","body":"I think this could work only if the C# compiler know exactly what `ForEach()` does and has a guarantee that it won't change.\r\n\r\nBut neither is true: the C# compiler often compiles against reference assemblies, which don't contain any code. And even if you compile against assemblies with code, the user is free to use different implementation when running the code."}}
{"actor":{"display_login":"svick"}}