{"action":"created","issue":{"url":"https://api.github.com/repos/D-Programming-Language/phobos/issues/3225","labels_url":"https://api.github.com/repos/D-Programming-Language/phobos/issues/3225/labels{/name}","comments_url":"https://api.github.com/repos/D-Programming-Language/phobos/issues/3225/comments","events_url":"https://api.github.com/repos/D-Programming-Language/phobos/issues/3225/events","html_url":"https://github.com/D-Programming-Language/phobos/pull/3225","id":70894591,"number":3225,"title":"Further changes to std.typecons.Unique","user":{"login":"JakobOvrum","id":155856,"avatar_url":"https://avatars.githubusercontent.com/u/155856?v=3","gravatar_id":"","url":"https://api.github.com/users/JakobOvrum","html_url":"https://github.com/JakobOvrum","followers_url":"https://api.github.com/users/JakobOvrum/followers","following_url":"https://api.github.com/users/JakobOvrum/following{/other_user}","gists_url":"https://api.github.com/users/JakobOvrum/gists{/gist_id}","starred_url":"https://api.github.com/users/JakobOvrum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JakobOvrum/subscriptions","organizations_url":"https://api.github.com/users/JakobOvrum/orgs","repos_url":"https://api.github.com/users/JakobOvrum/repos","events_url":"https://api.github.com/users/JakobOvrum/events{/privacy}","received_events_url":"https://api.github.com/users/JakobOvrum/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-04-25T11:22:31Z","updated_at":"2015-04-25T11:27:16Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/D-Programming-Language/phobos/pulls/3225","html_url":"https://github.com/D-Programming-Language/phobos/pull/3225","diff_url":"https://github.com/D-Programming-Language/phobos/pull/3225.diff","patch_url":"https://github.com/D-Programming-Language/phobos/pull/3225.patch"},"body":"Follow-up to #3139.\r\n\r\n* Documentation fixes and improvements\r\n* Added examples\r\n* A fix for destruction of held non-class values\r\n* Deprecated `empty` in favour of `cast(bool)`\r\n* Initialization is now a precondition for `get`ing non-class values, to support `nothrow`\r\n\r\n`get` is still a template with two overloads because it's the only way to make the documentation show them both, as far as I can tell.\r\n\r\n### Deprecation of `empty`\r\n\r\nCurrently there are two ways to check the validity of a `Unique` reference, `empty` and `cast(bool)`. I think we should only have one, and that is `cast(bool)`: `empty` is not only a bad name as it implies a range or container, but is highly likely to hijack `T.empty` in user code, which could conceivably cause hard to catch bugs (\"why does it claim my unique container/range is never empty??\").\r\n\r\n### Initialization now a precondition for `get`ing non-class values\r\n\r\nThis is required to support `nothrow`. I plan on working on other attributes, particularly `@safe`, once #3031 is ready and merged.\r\n\r\n---\r\n\r\nWhat do you guys think?\r\n\r\nedit:\r\n\r\nBTW, what's up with deprecations not showing up in documentation?"},"comment":{"url":"https://api.github.com/repos/D-Programming-Language/phobos/issues/comments/96177397","html_url":"https://github.com/D-Programming-Language/phobos/pull/3225#issuecomment-96177397","issue_url":"https://api.github.com/repos/D-Programming-Language/phobos/issues/3225","id":96177397,"user":{"login":"Dicebot","id":1132234,"avatar_url":"https://avatars.githubusercontent.com/u/1132234?v=3","gravatar_id":"","url":"https://api.github.com/users/Dicebot","html_url":"https://github.com/Dicebot","followers_url":"https://api.github.com/users/Dicebot/followers","following_url":"https://api.github.com/users/Dicebot/following{/other_user}","gists_url":"https://api.github.com/users/Dicebot/gists{/gist_id}","starred_url":"https://api.github.com/users/Dicebot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Dicebot/subscriptions","organizations_url":"https://api.github.com/users/Dicebot/orgs","repos_url":"https://api.github.com/users/Dicebot/repos","events_url":"https://api.github.com/users/Dicebot/events{/privacy}","received_events_url":"https://api.github.com/users/Dicebot/received_events","type":"User","site_admin":false},"created_at":"2015-04-25T11:27:15Z","updated_at":"2015-04-25T11:27:15Z","body":"I am very opposed to leaving `cast(bool)` as the only way to check validity for the very reason it is a cast, inherently dangerous thing that needs to be avoided as much as possible. `empty` is a bad name but it can be simply replaced with something like `initialized` or `valid`."}}