{"action":"created","issue":{"url":"https://api.github.com/repos/zig-lang/zig/issues/770","repository_url":"https://api.github.com/repos/zig-lang/zig","labels_url":"https://api.github.com/repos/zig-lang/zig/issues/770/labels{/name}","comments_url":"https://api.github.com/repos/zig-lang/zig/issues/770/comments","events_url":"https://api.github.com/repos/zig-lang/zig/issues/770/events","html_url":"https://github.com/zig-lang/zig/issues/770","id":296161930,"number":770,"title":"Pointer Reform","user":{"login":"andrewrk","id":106511,"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":693801403,"url":"https://api.github.com/repos/zig-lang/zig/labels/accepted","name":"accepted","color":"0efa16","default":false},{"id":693800736,"url":"https://api.github.com/repos/zig-lang/zig/labels/proposal","name":"proposal","color":"aaefdc","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/zig-lang/zig/milestones/3","html_url":"https://github.com/zig-lang/zig/milestone/3","labels_url":"https://api.github.com/repos/zig-lang/zig/milestones/3/labels","id":2411510,"number":3,"title":"0.2.0","description":"Accept and resolve these issues, reject, or postpone them before releasing 0.2.0.","creator":{"login":"andrewrk","id":106511,"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":63,"closed_issues":87,"state":"open","created_at":"2017-03-26T10:56:36Z","updated_at":"2018-02-18T18:43:41Z","due_on":"2018-03-05T08:00:00Z","closed_at":null},"comments":17,"created_at":"2018-02-11T05:20:12Z","updated_at":"2018-02-25T17:24:26Z","closed_at":null,"author_association":"OWNER","body":"**EDIT**: Latest iteration of the proposal: https://github.com/zig-lang/zig/issues/770#issuecomment-368111127\r\n\r\n`&` only used for address-of, no longer designates a pointer type. Necessary because of #588 \r\n\r\n* `^` pointer to exactly 1 thing.\r\n* `[*]` pointer to a block of memory of unknown length\r\n* `[*]null` pointer to block of memory, null-terminated (or 0 terminated for integers). #265 \r\n* `[]` pointer to a block of memory with runtime known length. status quo slices.\r\n* `[]null` pointer to a block of memory with runtime known length, with a null/0 at ptr[len]\r\n* `[N]` pointer to a block of memory with comptime known length\r\n* `[N]null` pointer to a block of memory with comptime known length, and a null/0 at ptr[N]\r\n\r\nAll of them support pointer indexing and slicing except `^`. Only `[*]` supports pointer arithmetic. All of them implicitly cast to `[*]`. `[]null` and `[N]null` implicitly cast to `[*]null`.\r\n\r\n * `&ptr[x]` and `&foo` always gives a `^`.\r\n * `ptr[x..y]` with comptime known x and y gives a `[N]`.\r\n * `array[x..]` gives a `[N]`.\r\n\r\nnew array syntax\r\n\r\n```zig\r\nvar array: 4*i32 = undefined;\r\n```\r\n\r\n\r\nNow it is clear whether you should do `&array` or `&array[0]`. Don't use `&array`. If you want a `[N]T`, e.g. a pointer with comptime known length, use `array[0..]`. If the function wants to access more than one element, you'll do this. Otherwise, `&array[0]`, will give `^T`, which would trigger a compile error if the array was length 0, and only this element can be accessed via this pointer.\r\n\r\nThis paves the way for #733 \r\nSee also #386 \r\nSee also #568 \r\n"},"comment":{"url":"https://api.github.com/repos/zig-lang/zig/issues/comments/368327107","html_url":"https://github.com/zig-lang/zig/issues/770#issuecomment-368327107","issue_url":"https://api.github.com/repos/zig-lang/zig/issues/770","id":368327107,"user":{"login":"thejoshwolfe","id":87436,"avatar_url":"https://avatars2.githubusercontent.com/u/87436?v=4","gravatar_id":"","url":"https://api.github.com/users/thejoshwolfe","html_url":"https://github.com/thejoshwolfe","followers_url":"https://api.github.com/users/thejoshwolfe/followers","following_url":"https://api.github.com/users/thejoshwolfe/following{/other_user}","gists_url":"https://api.github.com/users/thejoshwolfe/gists{/gist_id}","starred_url":"https://api.github.com/users/thejoshwolfe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thejoshwolfe/subscriptions","organizations_url":"https://api.github.com/users/thejoshwolfe/orgs","repos_url":"https://api.github.com/users/thejoshwolfe/repos","events_url":"https://api.github.com/users/thejoshwolfe/events{/privacy}","received_events_url":"https://api.github.com/users/thejoshwolfe/received_events","type":"User","site_admin":false},"created_at":"2018-02-25T17:24:26Z","updated_at":"2018-02-25T17:24:26Z","author_association":"OWNER","body":"> While we're discussing different kinds of arrays,\r\n\r\nI broke that out into its own issue: #793"}}
{"actor":{"display_login":"thejoshwolfe"}}