{"action":"created","issue":{"url":"https://api.github.com/repos/rust-lang/rfcs/issues/1320","labels_url":"https://api.github.com/repos/rust-lang/rfcs/issues/1320/labels{/name}","comments_url":"https://api.github.com/repos/rust-lang/rfcs/issues/1320/comments","events_url":"https://api.github.com/repos/rust-lang/rfcs/issues/1320/events","html_url":"https://github.com/rust-lang/rfcs/pull/1320","id":111252295,"number":1320,"title":"Amend 1192 (RangeInclusive) to use an enum.","user":{"login":"Stebalien","id":310393,"avatar_url":"https://avatars.githubusercontent.com/u/310393?v=3","gravatar_id":"","url":"https://api.github.com/users/Stebalien","html_url":"https://github.com/Stebalien","followers_url":"https://api.github.com/users/Stebalien/followers","following_url":"https://api.github.com/users/Stebalien/following{/other_user}","gists_url":"https://api.github.com/users/Stebalien/gists{/gist_id}","starred_url":"https://api.github.com/users/Stebalien/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Stebalien/subscriptions","organizations_url":"https://api.github.com/users/Stebalien/orgs","repos_url":"https://api.github.com/users/Stebalien/repos","events_url":"https://api.github.com/users/Stebalien/events{/privacy}","received_events_url":"https://api.github.com/users/Stebalien/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/rust-lang/rfcs/labels/I-nominated","name":"I-nominated","color":"e11d21"},{"url":"https://api.github.com/repos/rust-lang/rfcs/labels/T-lang","name":"T-lang","color":"bfd4f2"},{"url":"https://api.github.com/repos/rust-lang/rfcs/labels/T-libs","name":"T-libs","color":"bfd4f2"}],"state":"open","locked":false,"assignee":{"login":"huonw","id":1203825,"avatar_url":"https://avatars.githubusercontent.com/u/1203825?v=3","gravatar_id":"","url":"https://api.github.com/users/huonw","html_url":"https://github.com/huonw","followers_url":"https://api.github.com/users/huonw/followers","following_url":"https://api.github.com/users/huonw/following{/other_user}","gists_url":"https://api.github.com/users/huonw/gists{/gist_id}","starred_url":"https://api.github.com/users/huonw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/huonw/subscriptions","organizations_url":"https://api.github.com/users/huonw/orgs","repos_url":"https://api.github.com/users/huonw/repos","events_url":"https://api.github.com/users/huonw/events{/privacy}","received_events_url":"https://api.github.com/users/huonw/received_events","type":"User","site_admin":false},"milestone":null,"comments":13,"created_at":"2015-10-13T19:27:57Z","updated_at":"2016-01-15T09:46:46Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/rust-lang/rfcs/pulls/1320","html_url":"https://github.com/rust-lang/rfcs/pull/1320","diff_url":"https://github.com/rust-lang/rfcs/pull/1320.diff","patch_url":"https://github.com/rust-lang/rfcs/pull/1320.patch"},"body":"This PR proposes that `RangeInclusive` be an enum with `Empty`/`NonEmpty` variants instead of a struct with a `finished` field:\r\n\r\n```rust\r\npub enum RangeInclusive<T> {\r\n    Empty,\r\n    NonEmpty {\r\n        start: T,\r\n        end: T,\r\n    }\r\n}\r\n```\r\n\r\nRational:\r\n\r\n1. `finished` is very iterator specific. Regardless of what happens, I think this field should be called `empty`.\r\n\r\n2. `start`/`end` don't make sense if the range is empty. Using an enum prevents users from using the `start`/`end` of spent ranges. Basically, this makes it impossible for users to do something like `foo(my_range.take(10)); bar(my_range)` and forget to check `finished` in `bar`.\r\n\r\n3. If we ever get more space optimizations (specifically, utf8 code point ones) `'a'...'z'` should be the same size as `'a'..'z'`.\r\n\r\n4. Don't have to allocate the next start when the end of the range is reached (slight constant factor gain..., maybe). "},"comment":{"url":"https://api.github.com/repos/rust-lang/rfcs/issues/comments/171915094","html_url":"https://github.com/rust-lang/rfcs/pull/1320#issuecomment-171915094","issue_url":"https://api.github.com/repos/rust-lang/rfcs/issues/1320","id":171915094,"user":{"login":"nikomatsakis","id":155238,"avatar_url":"https://avatars.githubusercontent.com/u/155238?v=3","gravatar_id":"","url":"https://api.github.com/users/nikomatsakis","html_url":"https://github.com/nikomatsakis","followers_url":"https://api.github.com/users/nikomatsakis/followers","following_url":"https://api.github.com/users/nikomatsakis/following{/other_user}","gists_url":"https://api.github.com/users/nikomatsakis/gists{/gist_id}","starred_url":"https://api.github.com/users/nikomatsakis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nikomatsakis/subscriptions","organizations_url":"https://api.github.com/users/nikomatsakis/orgs","repos_url":"https://api.github.com/users/nikomatsakis/repos","events_url":"https://api.github.com/users/nikomatsakis/events{/privacy}","received_events_url":"https://api.github.com/users/nikomatsakis/received_events","type":"User","site_admin":false},"created_at":"2016-01-15T09:46:46Z","updated_at":"2016-01-15T09:46:46Z","body":"**Hear ye, hear ye!** This RFC is now entering **final comment period**."}}