{"action":"created","comment":{"url":"https://api.github.com/repos/D-Programming-Language/phobos/pulls/comments/23692454","id":23692454,"diff_hunk":"@@ -5893,3 +5893,143 @@ public:\n     auto value = cast(int)flags_A;\n     assert(value == Enum.A);\n }\n+\n+/**\n+   Type constructor for head-const variables.\n+\n+   Head-const variables cannot be directly mutated or rebound, but references\n+   reached through the variable are typed with their original mutability.\n+\n+   It is equivalent to $(D final) variables in D1 and Java,\n+   as well as $(D readonly) variables in C#.\n+ */\n+struct HeadConst(T)\n+    if(!is(T == const) && !is(T == immutable))\n+{\n+    private:\n+    T data;\n+\n+    public:\n+    /// $(D HeadConst) subtypes $(D T) as an rvalue.\n+    inout(T) HeadConst_get() inout pure nothrow @nogc @safe","path":"std/typecons.d","position":22,"original_position":22,"commit_id":"8f46511efe2de27f873c72e138db54f15b8fadb7","original_commit_id":"8f46511efe2de27f873c72e138db54f15b8fadb7","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},"body":"> Is this actually a public function we want users to be able to use? I realize it probably needs to be public for the bellow alias to work, but let's not document it that way.\r\n\r\nYeah, it's public for AliasThis to work. I chose to document it because it's currently not possible to document an AliasThis declaration with DDoc, but it could simply be mentioned in the type description instead.\r\n\r\n> This is not pure nothrow (etc...), as it depends on the attributes applied to T's postblit.\r\n\r\nYou're right, I was hoping the postblit operator would be called in the environment of the callsite :( Removing the explicit attributes and relying on inference seems to work well.\r\n\r\n> Speaking of which, it might be worth having a const-by-ref overload.\r\n\r\nI tried this, but the const-by-ref overload is never chosen when the this-reference is `const`, and when I make it `inout` like the other overload, I get \"matches both\" errors.","created_at":"2015-01-28T15:07:18Z","updated_at":"2015-01-28T15:07:18Z","html_url":"https://github.com/D-Programming-Language/phobos/pull/2881#discussion_r23692454","pull_request_url":"https://api.github.com/repos/D-Programming-Language/phobos/pulls/2881","_links":{"self":{"href":"https://api.github.com/repos/D-Programming-Language/phobos/pulls/comments/23692454"},"html":{"href":"https://github.com/D-Programming-Language/phobos/pull/2881#discussion_r23692454"},"pull_request":{"href":"https://api.github.com/repos/D-Programming-Language/phobos/pulls/2881"}}},"pull_request":{"url":"https://api.github.com/repos/D-Programming-Language/phobos/pulls/2881","id":27646087,"html_url":"https://github.com/D-Programming-Language/phobos/pull/2881","diff_url":"https://github.com/D-Programming-Language/phobos/pull/2881.diff","patch_url":"https://github.com/D-Programming-Language/phobos/pull/2881.patch","issue_url":"https://api.github.com/repos/D-Programming-Language/phobos/issues/2881","number":2881,"state":"open","locked":false,"title":"Add std.typecons.HeadConst","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},"body":"A simple type constructor that replicates the functionality of the now-defunct `final` variable storage class, allowing for easy creation of \"read-only\" variables and fields without going the full mile with transitive immutability. Using `Final` is quite a bit shorter than using a private variable with a public getter, and it's easier to get right since using a property correctly requires understanding of `inout` and the various function attributes. I guess it's also a nice thing to point to when queried about by Java programmers, and maybe even useful for porting Java code to D.\r\n\r\nPlease destroy.","created_at":"2015-01-20T00:41:39Z","updated_at":"2015-01-28T15:07:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"81c327136c7410ddac4140c84e55044966ea3d1c","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/D-Programming-Language/phobos/pulls/2881/commits","review_comments_url":"https://api.github.com/repos/D-Programming-Language/phobos/pulls/2881/comments","review_comment_url":"https://api.github.com/repos/D-Programming-Language/phobos/pulls/comments/{number}","comments_url":"https://api.github.com/repos/D-Programming-Language/phobos/issues/2881/comments","statuses_url":"https://api.github.com/repos/D-Programming-Language/phobos/statuses/8f46511efe2de27f873c72e138db54f15b8fadb7","head":{"label":"JakobOvrum:final","ref":"final","sha":"8f46511efe2de27f873c72e138db54f15b8fadb7","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},"repo":{"id":6076265,"name":"phobos","full_name":"JakobOvrum/phobos","owner":{"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},"private":false,"html_url":"https://github.com/JakobOvrum/phobos","description":"Runtime library for the D programming language","fork":true,"url":"https://api.github.com/repos/JakobOvrum/phobos","forks_url":"https://api.github.com/repos/JakobOvrum/phobos/forks","keys_url":"https://api.github.com/repos/JakobOvrum/phobos/keys{/key_id}","collaborators_url":"https://api.github.com/repos/JakobOvrum/phobos/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/JakobOvrum/phobos/teams","hooks_url":"https://api.github.com/repos/JakobOvrum/phobos/hooks","issue_events_url":"https://api.github.com/repos/JakobOvrum/phobos/issues/events{/number}","events_url":"https://api.github.com/repos/JakobOvrum/phobos/events","assignees_url":"https://api.github.com/repos/JakobOvrum/phobos/assignees{/user}","branches_url":"https://api.github.com/repos/JakobOvrum/phobos/branches{/branch}","tags_url":"https://api.github.com/repos/JakobOvrum/phobos/tags","blobs_url":"https://api.github.com/repos/JakobOvrum/phobos/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/JakobOvrum/phobos/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/JakobOvrum/phobos/git/refs{/sha}","trees_url":"https://api.github.com/repos/JakobOvrum/phobos/git/trees{/sha}","statuses_url":"https://api.github.com/repos/JakobOvrum/phobos/statuses/{sha}","languages_url":"https://api.github.com/repos/JakobOvrum/phobos/languages","stargazers_url":"https://api.github.com/repos/JakobOvrum/phobos/stargazers","contributors_url":"https://api.github.com/repos/JakobOvrum/phobos/contributors","subscribers_url":"https://api.github.com/repos/JakobOvrum/phobos/subscribers","subscription_url":"https://api.github.com/repos/JakobOvrum/phobos/subscription","commits_url":"https://api.github.com/repos/JakobOvrum/phobos/commits{/sha}","git_commits_url":"https://api.github.com/repos/JakobOvrum/phobos/git/commits{/sha}","comments_url":"https://api.github.com/repos/JakobOvrum/phobos/comments{/number}","issue_comment_url":"https://api.github.com/repos/JakobOvrum/phobos/issues/comments/{number}","contents_url":"https://api.github.com/repos/JakobOvrum/phobos/contents/{+path}","compare_url":"https://api.github.com/repos/JakobOvrum/phobos/compare/{base}...{head}","merges_url":"https://api.github.com/repos/JakobOvrum/phobos/merges","archive_url":"https://api.github.com/repos/JakobOvrum/phobos/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/JakobOvrum/phobos/downloads","issues_url":"https://api.github.com/repos/JakobOvrum/phobos/issues{/number}","pulls_url":"https://api.github.com/repos/JakobOvrum/phobos/pulls{/number}","milestones_url":"https://api.github.com/repos/JakobOvrum/phobos/milestones{/number}","notifications_url":"https://api.github.com/repos/JakobOvrum/phobos/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/JakobOvrum/phobos/labels{/name}","releases_url":"https://api.github.com/repos/JakobOvrum/phobos/releases{/id}","created_at":"2012-10-04T14:09:48Z","updated_at":"2015-01-20T00:38:44Z","pushed_at":"2015-01-28T14:51:38Z","git_url":"git://github.com/JakobOvrum/phobos.git","ssh_url":"git@github.com:JakobOvrum/phobos.git","clone_url":"https://github.com/JakobOvrum/phobos.git","svn_url":"https://github.com/JakobOvrum/phobos","homepage":"d-programming-language.org","size":37346,"stargazers_count":0,"watchers_count":0,"language":"D","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"D-Programming-Language:master","ref":"master","sha":"9b3b2872458e23743b93781f1075dd6134f94ba6","user":{"login":"D-Programming-Language","id":565913,"avatar_url":"https://avatars.githubusercontent.com/u/565913?v=3","gravatar_id":"","url":"https://api.github.com/users/D-Programming-Language","html_url":"https://github.com/D-Programming-Language","followers_url":"https://api.github.com/users/D-Programming-Language/followers","following_url":"https://api.github.com/users/D-Programming-Language/following{/other_user}","gists_url":"https://api.github.com/users/D-Programming-Language/gists{/gist_id}","starred_url":"https://api.github.com/users/D-Programming-Language/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/D-Programming-Language/subscriptions","organizations_url":"https://api.github.com/users/D-Programming-Language/orgs","repos_url":"https://api.github.com/users/D-Programming-Language/repos","events_url":"https://api.github.com/users/D-Programming-Language/events{/privacy}","received_events_url":"https://api.github.com/users/D-Programming-Language/received_events","type":"Organization","site_admin":false},"repo":{"id":1257084,"name":"phobos","full_name":"D-Programming-Language/phobos","owner":{"login":"D-Programming-Language","id":565913,"avatar_url":"https://avatars.githubusercontent.com/u/565913?v=3","gravatar_id":"","url":"https://api.github.com/users/D-Programming-Language","html_url":"https://github.com/D-Programming-Language","followers_url":"https://api.github.com/users/D-Programming-Language/followers","following_url":"https://api.github.com/users/D-Programming-Language/following{/other_user}","gists_url":"https://api.github.com/users/D-Programming-Language/gists{/gist_id}","starred_url":"https://api.github.com/users/D-Programming-Language/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/D-Programming-Language/subscriptions","organizations_url":"https://api.github.com/users/D-Programming-Language/orgs","repos_url":"https://api.github.com/users/D-Programming-Language/repos","events_url":"https://api.github.com/users/D-Programming-Language/events{/privacy}","received_events_url":"https://api.github.com/users/D-Programming-Language/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/D-Programming-Language/phobos","description":"The standard library of the D programming language","fork":false,"url":"https://api.github.com/repos/D-Programming-Language/phobos","forks_url":"https://api.github.com/repos/D-Programming-Language/phobos/forks","keys_url":"https://api.github.com/repos/D-Programming-Language/phobos/keys{/key_id}","collaborators_url":"https://api.github.com/repos/D-Programming-Language/phobos/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/D-Programming-Language/phobos/teams","hooks_url":"https://api.github.com/repos/D-Programming-Language/phobos/hooks","issue_events_url":"https://api.github.com/repos/D-Programming-Language/phobos/issues/events{/number}","events_url":"https://api.github.com/repos/D-Programming-Language/phobos/events","assignees_url":"https://api.github.com/repos/D-Programming-Language/phobos/assignees{/user}","branches_url":"https://api.github.com/repos/D-Programming-Language/phobos/branches{/branch}","tags_url":"https://api.github.com/repos/D-Programming-Language/phobos/tags","blobs_url":"https://api.github.com/repos/D-Programming-Language/phobos/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/D-Programming-Language/phobos/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/D-Programming-Language/phobos/git/refs{/sha}","trees_url":"https://api.github.com/repos/D-Programming-Language/phobos/git/trees{/sha}","statuses_url":"https://api.github.com/repos/D-Programming-Language/phobos/statuses/{sha}","languages_url":"https://api.github.com/repos/D-Programming-Language/phobos/languages","stargazers_url":"https://api.github.com/repos/D-Programming-Language/phobos/stargazers","contributors_url":"https://api.github.com/repos/D-Programming-Language/phobos/contributors","subscribers_url":"https://api.github.com/repos/D-Programming-Language/phobos/subscribers","subscription_url":"https://api.github.com/repos/D-Programming-Language/phobos/subscription","commits_url":"https://api.github.com/repos/D-Programming-Language/phobos/commits{/sha}","git_commits_url":"https://api.github.com/repos/D-Programming-Language/phobos/git/commits{/sha}","comments_url":"https://api.github.com/repos/D-Programming-Language/phobos/comments{/number}","issue_comment_url":"https://api.github.com/repos/D-Programming-Language/phobos/issues/comments/{number}","contents_url":"https://api.github.com/repos/D-Programming-Language/phobos/contents/{+path}","compare_url":"https://api.github.com/repos/D-Programming-Language/phobos/compare/{base}...{head}","merges_url":"https://api.github.com/repos/D-Programming-Language/phobos/merges","archive_url":"https://api.github.com/repos/D-Programming-Language/phobos/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/D-Programming-Language/phobos/downloads","issues_url":"https://api.github.com/repos/D-Programming-Language/phobos/issues{/number}","pulls_url":"https://api.github.com/repos/D-Programming-Language/phobos/pulls{/number}","milestones_url":"https://api.github.com/repos/D-Programming-Language/phobos/milestones{/number}","notifications_url":"https://api.github.com/repos/D-Programming-Language/phobos/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/D-Programming-Language/phobos/labels{/name}","releases_url":"https://api.github.com/repos/D-Programming-Language/phobos/releases{/id}","created_at":"2011-01-15T07:00:06Z","updated_at":"2015-01-28T09:27:03Z","pushed_at":"2015-01-28T09:27:03Z","git_url":"git://github.com/D-Programming-Language/phobos.git","ssh_url":"git@github.com:D-Programming-Language/phobos.git","clone_url":"https://github.com/D-Programming-Language/phobos.git","svn_url":"https://github.com/D-Programming-Language/phobos","homepage":"dlang.org/phobos","size":63697,"stargazers_count":557,"watchers_count":557,"language":"D","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":371,"mirror_url":null,"open_issues_count":36,"forks":371,"open_issues":36,"watchers":557,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/D-Programming-Language/phobos/pulls/2881"},"html":{"href":"https://github.com/D-Programming-Language/phobos/pull/2881"},"issue":{"href":"https://api.github.com/repos/D-Programming-Language/phobos/issues/2881"},"comments":{"href":"https://api.github.com/repos/D-Programming-Language/phobos/issues/2881/comments"},"review_comments":{"href":"https://api.github.com/repos/D-Programming-Language/phobos/pulls/2881/comments"},"review_comment":{"href":"https://api.github.com/repos/D-Programming-Language/phobos/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/D-Programming-Language/phobos/pulls/2881/commits"},"statuses":{"href":"https://api.github.com/repos/D-Programming-Language/phobos/statuses/8f46511efe2de27f873c72e138db54f15b8fadb7"}}}}