{"action":"created","issue":{"url":"https://api.github.com/repos/ziglang/zig/issues/498","repository_url":"https://api.github.com/repos/ziglang/zig","labels_url":"https://api.github.com/repos/ziglang/zig/issues/498/labels{/name}","comments_url":"https://api.github.com/repos/ziglang/zig/issues/498/comments","events_url":"https://api.github.com/repos/ziglang/zig/issues/498/events","html_url":"https://github.com/ziglang/zig/issues/498","id":260492755,"node_id":"MDU6SXNzdWUyNjA0OTI3NTU=","number":498,"title":"add syntax to destructure array initialization lists","user":{"login":"andrewrk","id":106511,"node_id":"MDQ6VXNlcjEwNjUxMQ==","avatar_url":"https://avatars0.githubusercontent.com/u/106511?v=4","gravatar_id":"","url":"https://api.github.com/users/andrewrk","html_url":"https://github.com/andrewrk","followers_url":"https://api.github.com/users/andrewrk/followers","following_url":"https://api.github.com/users/andrewrk/following{/other_user}","gists_url":"https://api.github.com/users/andrewrk/gists{/gist_id}","starred_url":"https://api.github.com/users/andrewrk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andrewrk/subscriptions","organizations_url":"https://api.github.com/users/andrewrk/orgs","repos_url":"https://api.github.com/users/andrewrk/repos","events_url":"https://api.github.com/users/andrewrk/events{/privacy}","received_events_url":"https://api.github.com/users/andrewrk/received_events","type":"User","site_admin":false},"labels":[{"id":693800736,"node_id":"MDU6TGFiZWw2OTM4MDA3MzY=","url":"https://api.github.com/repos/ziglang/zig/labels/proposal","name":"proposal","color":"aaefdc","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/ziglang/zig/milestones/6","html_url":"https://github.com/ziglang/zig/milestone/6","labels_url":"https://api.github.com/repos/ziglang/zig/milestones/6/labels","id":3149533,"node_id":"MDk6TWlsZXN0b25lMzE0OTUzMw==","number":6,"title":"0.4.0","description":"Accept and resolve these issues, reject, or postpone them before releasing 0.4.0.","creator":{"login":"andrewrk","id":106511,"node_id":"MDQ6VXNlcjEwNjUxMQ==","avatar_url":"https://avatars0.githubusercontent.com/u/106511?v=4","gravatar_id":"","url":"https://api.github.com/users/andrewrk","html_url":"https://github.com/andrewrk","followers_url":"https://api.github.com/users/andrewrk/followers","following_url":"https://api.github.com/users/andrewrk/following{/other_user}","gists_url":"https://api.github.com/users/andrewrk/gists{/gist_id}","starred_url":"https://api.github.com/users/andrewrk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andrewrk/subscriptions","organizations_url":"https://api.github.com/users/andrewrk/orgs","repos_url":"https://api.github.com/users/andrewrk/repos","events_url":"https://api.github.com/users/andrewrk/events{/privacy}","received_events_url":"https://api.github.com/users/andrewrk/received_events","type":"User","site_admin":false},"open_issues":360,"closed_issues":41,"state":"open","created_at":"2018-02-28T05:37:00Z","updated_at":"2018-11-21T03:54:47Z","due_on":"2019-03-15T07:00:00Z","closed_at":null},"comments":13,"created_at":"2017-09-26T05:09:29Z","updated_at":"2018-11-21T03:57:48Z","closed_at":null,"author_association":"MEMBER","body":"This proposal is an alternative to the rejected multiple expression values proposal (#83). It affects inline assembly improvements (#215). It depends on or at least is related to [my comment](https://github.com/zig-lang/zig/issues/346#issuecomment-329266675) in #346.\r\n\r\n * Add ability for functions to have multiple return values.\r\n\r\n```zig\r\nfn div(numerator: i32, denominator: i32) -> i32, i32 {\r\n    return numerator / denominator, numerator % denominator;\r\n}\r\n````\r\n\r\n * If you want an error, it's recommended to use a struct:\r\n\r\n```zig\r\nerror DivByZero;\r\nconst DivResult = struct {quotient: i32, remainder: i32 };\r\nfn div(numerator: i32, denominator: i32) -> %DivResult {\r\n    if (denominator == 0) return error.DivByZero;\r\n    return DivResult {\r\n        .quotient = numerator / denominator,\r\n        .remainder = numerator % denominator,\r\n    };\r\n}\r\n```\r\n\r\n * `return` statements can have multiple return values:\r\n\r\n```zig\r\nfn foo(condition: bool) {\r\n    const x, const y = div(3, 1);\r\n    const a, const b = if (condition) {\r\n        return :this false, 1234;\r\n    } else {\r\n        return :this true, 5678;\r\n    };\r\n}\r\n```\r\n\r\nThis is not general-purpose tuples. This is multiple assignment and multiple return values.\r\n\r\nReal Actual Use Case: https://github.com/zig-lang/zig/blob/cba4a9ad4a149766c650e3f3d71435cef14867a3/std/os/child_process.zig#L237-L246"},"comment":{"url":"https://api.github.com/repos/ziglang/zig/issues/comments/440521357","html_url":"https://github.com/ziglang/zig/issues/498#issuecomment-440521357","issue_url":"https://api.github.com/repos/ziglang/zig/issues/498","id":440521357,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0MDUyMTM1Nw==","user":{"login":"andrewrk","id":106511,"node_id":"MDQ6VXNlcjEwNjUxMQ==","avatar_url":"https://avatars0.githubusercontent.com/u/106511?v=4","gravatar_id":"","url":"https://api.github.com/users/andrewrk","html_url":"https://github.com/andrewrk","followers_url":"https://api.github.com/users/andrewrk/followers","following_url":"https://api.github.com/users/andrewrk/following{/other_user}","gists_url":"https://api.github.com/users/andrewrk/gists{/gist_id}","starred_url":"https://api.github.com/users/andrewrk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andrewrk/subscriptions","organizations_url":"https://api.github.com/users/andrewrk/orgs","repos_url":"https://api.github.com/users/andrewrk/repos","events_url":"https://api.github.com/users/andrewrk/events{/privacy}","received_events_url":"https://api.github.com/users/andrewrk/received_events","type":"User","site_admin":false},"created_at":"2018-11-21T03:57:48Z","updated_at":"2018-11-21T03:57:48Z","author_association":"MEMBER","body":"This proposal depends on #208 and #287 and would allow something like this:\r\n\r\n```zig\r\nconst S = struct {field: i32};\r\nvar s: S = undefined;\r\nvar x, const y, s.field = blk: {\r\n    break :blk .{foo(), bar(), baz() + 1};\r\n};\r\n```"}}
{"actor":{"display_login":"andrewrk"}}