{"action":"created","issue":{"url":"https://api.github.com/repos/redox-os/ion/issues/302","repository_url":"https://api.github.com/repos/redox-os/ion","labels_url":"https://api.github.com/repos/redox-os/ion/issues/302/labels{/name}","comments_url":"https://api.github.com/repos/redox-os/ion/issues/302/comments","events_url":"https://api.github.com/repos/redox-os/ion/issues/302/events","html_url":"https://github.com/redox-os/ion/pull/302","id":236283090,"number":302,"title":"[WIP] Refactor `Index`, etc. into `Select`, `Range`, and `Index`","user":{"login":"huntergoldstein","id":5455867,"avatar_url":"https://avatars1.githubusercontent.com/u/5455867?v=3","gravatar_id":"","url":"https://api.github.com/users/huntergoldstein","html_url":"https://github.com/huntergoldstein","followers_url":"https://api.github.com/users/huntergoldstein/followers","following_url":"https://api.github.com/users/huntergoldstein/following{/other_user}","gists_url":"https://api.github.com/users/huntergoldstein/gists{/gist_id}","starred_url":"https://api.github.com/users/huntergoldstein/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/huntergoldstein/subscriptions","organizations_url":"https://api.github.com/users/huntergoldstein/orgs","repos_url":"https://api.github.com/users/huntergoldstein/repos","events_url":"https://api.github.com/users/huntergoldstein/events{/privacy}","received_events_url":"https://api.github.com/users/huntergoldstein/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-06-15T18:56:08Z","updated_at":"2017-06-16T15:22:06Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/redox-os/ion/pulls/302","html_url":"https://github.com/redox-os/ion/pull/302","diff_url":"https://github.com/redox-os/ion/pull/302.diff","patch_url":"https://github.com/redox-os/ion/pull/302.patch"},"body":"**Problem**: The extra features introduced in #297 made it clear that `Index` `IndexStart` and `IndexEnd` were confusing to exist all together. \r\n\r\n**Solution**: This PR consolidates and appropriately separates the responisbilities of `Index`, `IndexStart`, and `IndexEnd` into `Select`, `Range`, and `Index.\r\n\r\n**Changes introduced by this pull request**:\r\n- Replaced top-level `Index` with `Select` which better captures the meaning of the enumeration: a selection of an array versus an index, which brings to mind a single element within the array.\r\n- Added a separate `Range` struct that encapsulates inclusive vs. exclusive\r\n- Consolidated `Index<blah>` into `Index::Forward` and `Index::Backward` and removed all of the `CatchAll` values. `CatchAll` is now represented by `Forward(0)` or `Backward(0)`.\r\n- Added explicit, versus implicit, failure cases when a range is invalid\r\n\r\n**Drawbacks**: \r\n- `Selection` is a more apt name but I wonder if there's something more precise\r\n- This is mostly due to the features in #297 but there are several places where some logic is repeated\r\n\r\n**TODOs**:\r\n- [ ] Move some of the repeated logic and patterns for iterators from their call-sites to `Range`; I would love it if this PR reduced the total line count \r\n- [x] Add documentation and real examples for `Range` and `Index`\r\n- [x] Add in more regression tests, especially now that `Range` is easily independently testable\r\n\r\n**State**: WIP\r\n\r\n**Related**: #297, #263 \r\n"},"comment":{"url":"https://api.github.com/repos/redox-os/ion/issues/comments/309055243","html_url":"https://github.com/redox-os/ion/pull/302#issuecomment-309055243","issue_url":"https://api.github.com/repos/redox-os/ion/issues/302","id":309055243,"user":{"login":"mmstick","id":4143535,"avatar_url":"https://avatars2.githubusercontent.com/u/4143535?v=3","gravatar_id":"","url":"https://api.github.com/users/mmstick","html_url":"https://github.com/mmstick","followers_url":"https://api.github.com/users/mmstick/followers","following_url":"https://api.github.com/users/mmstick/following{/other_user}","gists_url":"https://api.github.com/users/mmstick/gists{/gist_id}","starred_url":"https://api.github.com/users/mmstick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mmstick/subscriptions","organizations_url":"https://api.github.com/users/mmstick/orgs","repos_url":"https://api.github.com/users/mmstick/repos","events_url":"https://api.github.com/users/mmstick/events{/privacy}","received_events_url":"https://api.github.com/users/mmstick/received_events","type":"User","site_admin":false},"created_at":"2017-06-16T15:22:06Z","updated_at":"2017-06-16T15:22:06Z","body":"The length of the iterator should be known at runtime by taking the size of the array and doing a calculation like `array.len() - start - (end - start)`"}}
{"actor":{"display_login":"mmstick"}}