{"action":"created","issue":{"url":"https://api.github.com/repos/JuliaLang/julia/issues/28579","repository_url":"https://api.github.com/repos/JuliaLang/julia","labels_url":"https://api.github.com/repos/JuliaLang/julia/issues/28579/labels{/name}","comments_url":"https://api.github.com/repos/JuliaLang/julia/issues/28579/comments","events_url":"https://api.github.com/repos/JuliaLang/julia/issues/28579/events","html_url":"https://github.com/JuliaLang/julia/issues/28579","id":349687532,"node_id":"MDU6SXNzdWUzNDk2ODc1MzI=","number":28579,"title":"NamedTuple unpacking (and also struct unpacking)","user":{"login":"mauro3","id":4098145,"node_id":"MDQ6VXNlcjQwOTgxNDU=","avatar_url":"https://avatars1.githubusercontent.com/u/4098145?v=4","gravatar_id":"","url":"https://api.github.com/users/mauro3","html_url":"https://github.com/mauro3","followers_url":"https://api.github.com/users/mauro3/followers","following_url":"https://api.github.com/users/mauro3/following{/other_user}","gists_url":"https://api.github.com/users/mauro3/gists{/gist_id}","starred_url":"https://api.github.com/users/mauro3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mauro3/subscriptions","organizations_url":"https://api.github.com/users/mauro3/orgs","repos_url":"https://api.github.com/users/mauro3/repos","events_url":"https://api.github.com/users/mauro3/events{/privacy}","received_events_url":"https://api.github.com/users/mauro3/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-08-10T23:56:42Z","updated_at":"2018-08-11T08:40:29Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"During JuliaCon discussion with @ahojukka5, I figured it would be cool to have NamedTuple unpacking in function arguments which honors the names of the named tuple.  Currently we have:\r\n```\r\njulia> nt = (a=1, b=2)\r\n\r\njulia> f((b,)=nt) = b                                                                                                                                        \r\nf (generic function with 1 method)                                                                                                                          \r\n\r\njulia> f(nt)                                                                                                                                                 \r\n1                                                                                                                                                            \r\n```\r\ninstead, I'd think this would be more intuitive:\r\n```\r\njulia> f(nt)                                                                                                                                                 \r\n2\r\n```\r\nSimilarly it could work for structs:\r\n```\r\njulia> struct A; a; b end                                                                                                                                    \r\n                                                                                                                                                             \r\njulia> aa = A(1,2)                                                                                                                                            \r\nA(1, 2)                                                                                                                                                      \r\n                                                                                                                                                             \r\njulia> f(aa)                                                                                                                                                  \r\n2\r\n```\r\n\r\n(Unfortunately, this needs a 2.0 label)"},"comment":{"url":"https://api.github.com/repos/JuliaLang/julia/issues/comments/412261054","html_url":"https://github.com/JuliaLang/julia/issues/28579#issuecomment-412261054","issue_url":"https://api.github.com/repos/JuliaLang/julia/issues/28579","id":412261054,"node_id":"MDEyOklzc3VlQ29tbWVudDQxMjI2MTA1NA==","user":{"login":"JeffBezanson","id":744556,"node_id":"MDQ6VXNlcjc0NDU1Ng==","avatar_url":"https://avatars0.githubusercontent.com/u/744556?v=4","gravatar_id":"","url":"https://api.github.com/users/JeffBezanson","html_url":"https://github.com/JeffBezanson","followers_url":"https://api.github.com/users/JeffBezanson/followers","following_url":"https://api.github.com/users/JeffBezanson/following{/other_user}","gists_url":"https://api.github.com/users/JeffBezanson/gists{/gist_id}","starred_url":"https://api.github.com/users/JeffBezanson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JeffBezanson/subscriptions","organizations_url":"https://api.github.com/users/JeffBezanson/orgs","repos_url":"https://api.github.com/users/JeffBezanson/repos","events_url":"https://api.github.com/users/JeffBezanson/events{/privacy}","received_events_url":"https://api.github.com/users/JeffBezanson/received_events","type":"User","site_admin":false},"created_at":"2018-08-11T08:40:29Z","updated_at":"2018-08-11T08:40:29Z","author_association":"MEMBER","body":"`(b,)` already means positional unpacking, so the syntax would have to be `(; b,)` or `(b=b,`)."}}
{"actor":{"display_login":"JeffBezanson"}}