{"action":"created","comment":{"url":"https://api.github.com/repos/dlang/phobos/pulls/comments/76612598","id":76612598,"diff_hunk":"@@ -802,3 +802,224 @@ private template findCovariantFunction(alias finfo, Source, Fs...)\n     else\n         enum ptrdiff_t findCovariantFunction = x;\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+It is equivalent to $(D final) variables in D1 and Java, as well as\n+$(D readonly) variables in C#.\n+\n+When $(D T) is a $(D const) or $(D immutable) type, $(D HeadConst) aliases\n+to $(D T).\n+*/\n+struct HeadConst(T)\n+    if (!is(T == const) && !is(T == immutable))\n+{\n+    import std.typecons : Proxy;\n+\n+    private T headConst_value;\n+    mixin Proxy!headConst_value;\n+\n+    /**\n+     * Construction is forwarded to the underlying type.\n+     */\n+    this(T other)\n+    {\n+        this.headConst_value = other;\n+    }\n+\n+    /// Ditto\n+    this(Args...)(auto ref Args args)\n+        if (__traits(compiles, T(args)))\n+    {\n+        static assert((!is(T == struct) && !is(T == union)) || !isNested!T,\n+            \"Non-static nested type \" ~ fullyQualifiedName!T ~ \" must be \" ~\n+            \"constructed explicitly at the call-site (e.g. auto s = \" ~\n+            \"headConst(\" ~ T.stringof ~ \"(...));)\");\n+        this.headConst_value = T(args);\n+    }\n+\n+    // Attaching function attributes gives less noisy error messages\n+    pure nothrow @safe @nogc\n+    {\n+        /++\n+         + All operators, including member access, are forwarded to the\n+         + underlying value of type $(D T) except for these mutating operators,\n+         + which are disabled.\n+         +/\n+        @disable void opAssign(Other)(Other other);\n+        @disable void opOpAssign(string op, Other)(Other other); /// Ditto\n+        @disable void opUnary(string op : \"--\")(); /// Ditto\n+        @disable void opUnary(string op : \"++\")(); /// Ditto\n+    }\n+\n+    /**\n+     *\n+     * $(D HeadConst!T) implicitly converts to an rvalue of type $(D T) through\n+     * $(D AliasThis).\n+     */\n+    inout(T) headConst_get() inout\n+    {\n+        return headConst_value;\n+    }\n+\n+    /// Ditto\n+    alias headConst_get this;\n+\n+    /// Ditto\n+    auto ref T opUnary(string op)()\n+        if (__traits(compiles, mixin(op ~ \"T.init\")))\n+    {\n+        return mixin(op ~ \"this.headConst_value\");\n+    }\n+}\n+\n+/// Ditto","path":"std/experimental/typecons.d","position":78,"original_position":78,"commit_id":"986f838f1560a8d8b85559e49cf6d0ac64e5070e","original_commit_id":"986f838f1560a8d8b85559e49cf6d0ac64e5070e","user":{"login":"andralex","id":566679,"avatar_url":"https://avatars.githubusercontent.com/u/566679?v=3","gravatar_id":"","url":"https://api.github.com/users/andralex","html_url":"https://github.com/andralex","followers_url":"https://api.github.com/users/andralex/followers","following_url":"https://api.github.com/users/andralex/following{/other_user}","gists_url":"https://api.github.com/users/andralex/gists{/gist_id}","starred_url":"https://api.github.com/users/andralex/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andralex/subscriptions","organizations_url":"https://api.github.com/users/andralex/orgs","repos_url":"https://api.github.com/users/andralex/repos","events_url":"https://api.github.com/users/andralex/events{/privacy}","received_events_url":"https://api.github.com/users/andralex/received_events","type":"User","site_admin":false},"body":"For the sake of docs, I suggest massaging this inside the main definition. The downside is that all significant code gets indented one level, but there's not a lot of it.","created_at":"2016-08-29T14:06:55Z","updated_at":"2016-08-29T14:06:55Z","html_url":"https://github.com/dlang/phobos/pull/4755#discussion_r76612598","pull_request_url":"https://api.github.com/repos/dlang/phobos/pulls/4755","_links":{"self":{"href":"https://api.github.com/repos/dlang/phobos/pulls/comments/76612598"},"html":{"href":"https://github.com/dlang/phobos/pull/4755#discussion_r76612598"},"pull_request":{"href":"https://api.github.com/repos/dlang/phobos/pulls/4755"}}},"pull_request":{"url":"https://api.github.com/repos/dlang/phobos/pulls/4755","id":83034868,"html_url":"https://github.com/dlang/phobos/pull/4755","diff_url":"https://github.com/dlang/phobos/pull/4755.diff","patch_url":"https://github.com/dlang/phobos/pull/4755.patch","issue_url":"https://api.github.com/repos/dlang/phobos/issues/4755","number":4755,"state":"open","locked":false,"title":"Add std.experimental.typecons.HeadConst","user":{"login":"wilzbach","id":4370550,"avatar_url":"https://avatars.githubusercontent.com/u/4370550?v=3","gravatar_id":"","url":"https://api.github.com/users/wilzbach","html_url":"https://github.com/wilzbach","followers_url":"https://api.github.com/users/wilzbach/followers","following_url":"https://api.github.com/users/wilzbach/following{/other_user}","gists_url":"https://api.github.com/users/wilzbach/gists{/gist_id}","starred_url":"https://api.github.com/users/wilzbach/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wilzbach/subscriptions","organizations_url":"https://api.github.com/users/wilzbach/orgs","repos_url":"https://api.github.com/users/wilzbach/repos","events_url":"https://api.github.com/users/wilzbach/events{/privacy}","received_events_url":"https://api.github.com/users/wilzbach/received_events","type":"User","site_admin":false},"body":"This is a revival of #3862 (which was an revival of #2881).\r\nThe status from @andralex was:\r\n\r\n> For more detail: we should define std.experimental.typecons and put this in it. With that I preapprove this addition. Thanks!\r\n\r\nUnfortunately @JakobOvrum seems to be away for the last few months, but we shouldn't let this great PR die ;-)\r\n\r\nI copy/pasted the addition to `std.experimental.typecons`, added the missing import. Full credit of course goes to @JakobOvrum (luckily git allows to set the history accordingly).\r\n\r\nI also included the changelog entry in a separate commit.","created_at":"2016-08-29T01:40:11Z","updated_at":"2016-08-29T14:06:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a75d596824f76846c1dfeb700a18d5bbab1f0d8a","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/dlang/phobos/pulls/4755/commits","review_comments_url":"https://api.github.com/repos/dlang/phobos/pulls/4755/comments","review_comment_url":"https://api.github.com/repos/dlang/phobos/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dlang/phobos/issues/4755/comments","statuses_url":"https://api.github.com/repos/dlang/phobos/statuses/986f838f1560a8d8b85559e49cf6d0ac64e5070e","head":{"label":"wilzbach:headconst-jakob","ref":"headconst-jakob","sha":"986f838f1560a8d8b85559e49cf6d0ac64e5070e","user":{"login":"wilzbach","id":4370550,"avatar_url":"https://avatars.githubusercontent.com/u/4370550?v=3","gravatar_id":"","url":"https://api.github.com/users/wilzbach","html_url":"https://github.com/wilzbach","followers_url":"https://api.github.com/users/wilzbach/followers","following_url":"https://api.github.com/users/wilzbach/following{/other_user}","gists_url":"https://api.github.com/users/wilzbach/gists{/gist_id}","starred_url":"https://api.github.com/users/wilzbach/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wilzbach/subscriptions","organizations_url":"https://api.github.com/users/wilzbach/orgs","repos_url":"https://api.github.com/users/wilzbach/repos","events_url":"https://api.github.com/users/wilzbach/events{/privacy}","received_events_url":"https://api.github.com/users/wilzbach/received_events","type":"User","site_admin":false},"repo":{"id":52009651,"name":"phobos","full_name":"wilzbach/phobos","owner":{"login":"wilzbach","id":4370550,"avatar_url":"https://avatars.githubusercontent.com/u/4370550?v=3","gravatar_id":"","url":"https://api.github.com/users/wilzbach","html_url":"https://github.com/wilzbach","followers_url":"https://api.github.com/users/wilzbach/followers","following_url":"https://api.github.com/users/wilzbach/following{/other_user}","gists_url":"https://api.github.com/users/wilzbach/gists{/gist_id}","starred_url":"https://api.github.com/users/wilzbach/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wilzbach/subscriptions","organizations_url":"https://api.github.com/users/wilzbach/orgs","repos_url":"https://api.github.com/users/wilzbach/repos","events_url":"https://api.github.com/users/wilzbach/events{/privacy}","received_events_url":"https://api.github.com/users/wilzbach/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/wilzbach/phobos","description":"The standard library of the D programming language","fork":true,"url":"https://api.github.com/repos/wilzbach/phobos","forks_url":"https://api.github.com/repos/wilzbach/phobos/forks","keys_url":"https://api.github.com/repos/wilzbach/phobos/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wilzbach/phobos/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wilzbach/phobos/teams","hooks_url":"https://api.github.com/repos/wilzbach/phobos/hooks","issue_events_url":"https://api.github.com/repos/wilzbach/phobos/issues/events{/number}","events_url":"https://api.github.com/repos/wilzbach/phobos/events","assignees_url":"https://api.github.com/repos/wilzbach/phobos/assignees{/user}","branches_url":"https://api.github.com/repos/wilzbach/phobos/branches{/branch}","tags_url":"https://api.github.com/repos/wilzbach/phobos/tags","blobs_url":"https://api.github.com/repos/wilzbach/phobos/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wilzbach/phobos/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wilzbach/phobos/git/refs{/sha}","trees_url":"https://api.github.com/repos/wilzbach/phobos/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wilzbach/phobos/statuses/{sha}","languages_url":"https://api.github.com/repos/wilzbach/phobos/languages","stargazers_url":"https://api.github.com/repos/wilzbach/phobos/stargazers","contributors_url":"https://api.github.com/repos/wilzbach/phobos/contributors","subscribers_url":"https://api.github.com/repos/wilzbach/phobos/subscribers","subscription_url":"https://api.github.com/repos/wilzbach/phobos/subscription","commits_url":"https://api.github.com/repos/wilzbach/phobos/commits{/sha}","git_commits_url":"https://api.github.com/repos/wilzbach/phobos/git/commits{/sha}","comments_url":"https://api.github.com/repos/wilzbach/phobos/comments{/number}","issue_comment_url":"https://api.github.com/repos/wilzbach/phobos/issues/comments{/number}","contents_url":"https://api.github.com/repos/wilzbach/phobos/contents/{+path}","compare_url":"https://api.github.com/repos/wilzbach/phobos/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wilzbach/phobos/merges","archive_url":"https://api.github.com/repos/wilzbach/phobos/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wilzbach/phobos/downloads","issues_url":"https://api.github.com/repos/wilzbach/phobos/issues{/number}","pulls_url":"https://api.github.com/repos/wilzbach/phobos/pulls{/number}","milestones_url":"https://api.github.com/repos/wilzbach/phobos/milestones{/number}","notifications_url":"https://api.github.com/repos/wilzbach/phobos/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wilzbach/phobos/labels{/name}","releases_url":"https://api.github.com/repos/wilzbach/phobos/releases{/id}","deployments_url":"https://api.github.com/repos/wilzbach/phobos/deployments","created_at":"2016-02-18T13:38:55Z","updated_at":"2016-03-08T13:03:37Z","pushed_at":"2016-08-29T12:10:44Z","git_url":"git://github.com/wilzbach/phobos.git","ssh_url":"git@github.com:wilzbach/phobos.git","clone_url":"https://github.com/wilzbach/phobos.git","svn_url":"https://github.com/wilzbach/phobos","homepage":"dlang.org/phobos","size":47110,"stargazers_count":1,"watchers_count":1,"language":"D","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":5,"forks":0,"open_issues":5,"watchers":1,"default_branch":"master"}},"base":{"label":"dlang:master","ref":"master","sha":"5c5dda3dfba0cc859864072b6247f4097b57dd3a","user":{"login":"dlang","id":565913,"avatar_url":"https://avatars.githubusercontent.com/u/565913?v=3","gravatar_id":"","url":"https://api.github.com/users/dlang","html_url":"https://github.com/dlang","followers_url":"https://api.github.com/users/dlang/followers","following_url":"https://api.github.com/users/dlang/following{/other_user}","gists_url":"https://api.github.com/users/dlang/gists{/gist_id}","starred_url":"https://api.github.com/users/dlang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dlang/subscriptions","organizations_url":"https://api.github.com/users/dlang/orgs","repos_url":"https://api.github.com/users/dlang/repos","events_url":"https://api.github.com/users/dlang/events{/privacy}","received_events_url":"https://api.github.com/users/dlang/received_events","type":"Organization","site_admin":false},"repo":{"id":1257084,"name":"phobos","full_name":"dlang/phobos","owner":{"login":"dlang","id":565913,"avatar_url":"https://avatars.githubusercontent.com/u/565913?v=3","gravatar_id":"","url":"https://api.github.com/users/dlang","html_url":"https://github.com/dlang","followers_url":"https://api.github.com/users/dlang/followers","following_url":"https://api.github.com/users/dlang/following{/other_user}","gists_url":"https://api.github.com/users/dlang/gists{/gist_id}","starred_url":"https://api.github.com/users/dlang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dlang/subscriptions","organizations_url":"https://api.github.com/users/dlang/orgs","repos_url":"https://api.github.com/users/dlang/repos","events_url":"https://api.github.com/users/dlang/events{/privacy}","received_events_url":"https://api.github.com/users/dlang/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dlang/phobos","description":"The standard library of the D programming language","fork":false,"url":"https://api.github.com/repos/dlang/phobos","forks_url":"https://api.github.com/repos/dlang/phobos/forks","keys_url":"https://api.github.com/repos/dlang/phobos/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dlang/phobos/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dlang/phobos/teams","hooks_url":"https://api.github.com/repos/dlang/phobos/hooks","issue_events_url":"https://api.github.com/repos/dlang/phobos/issues/events{/number}","events_url":"https://api.github.com/repos/dlang/phobos/events","assignees_url":"https://api.github.com/repos/dlang/phobos/assignees{/user}","branches_url":"https://api.github.com/repos/dlang/phobos/branches{/branch}","tags_url":"https://api.github.com/repos/dlang/phobos/tags","blobs_url":"https://api.github.com/repos/dlang/phobos/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dlang/phobos/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dlang/phobos/git/refs{/sha}","trees_url":"https://api.github.com/repos/dlang/phobos/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dlang/phobos/statuses/{sha}","languages_url":"https://api.github.com/repos/dlang/phobos/languages","stargazers_url":"https://api.github.com/repos/dlang/phobos/stargazers","contributors_url":"https://api.github.com/repos/dlang/phobos/contributors","subscribers_url":"https://api.github.com/repos/dlang/phobos/subscribers","subscription_url":"https://api.github.com/repos/dlang/phobos/subscription","commits_url":"https://api.github.com/repos/dlang/phobos/commits{/sha}","git_commits_url":"https://api.github.com/repos/dlang/phobos/git/commits{/sha}","comments_url":"https://api.github.com/repos/dlang/phobos/comments{/number}","issue_comment_url":"https://api.github.com/repos/dlang/phobos/issues/comments{/number}","contents_url":"https://api.github.com/repos/dlang/phobos/contents/{+path}","compare_url":"https://api.github.com/repos/dlang/phobos/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dlang/phobos/merges","archive_url":"https://api.github.com/repos/dlang/phobos/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dlang/phobos/downloads","issues_url":"https://api.github.com/repos/dlang/phobos/issues{/number}","pulls_url":"https://api.github.com/repos/dlang/phobos/pulls{/number}","milestones_url":"https://api.github.com/repos/dlang/phobos/milestones{/number}","notifications_url":"https://api.github.com/repos/dlang/phobos/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dlang/phobos/labels{/name}","releases_url":"https://api.github.com/repos/dlang/phobos/releases{/id}","deployments_url":"https://api.github.com/repos/dlang/phobos/deployments","created_at":"2011-01-15T07:00:06Z","updated_at":"2016-08-29T10:58:11Z","pushed_at":"2016-08-29T12:10:45Z","git_url":"git://github.com/dlang/phobos.git","ssh_url":"git@github.com:dlang/phobos.git","clone_url":"https://github.com/dlang/phobos.git","svn_url":"https://github.com/dlang/phobos","homepage":"dlang.org/phobos","size":76050,"stargazers_count":734,"watchers_count":734,"language":"D","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":511,"mirror_url":null,"open_issues_count":90,"forks":511,"open_issues":90,"watchers":734,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dlang/phobos/pulls/4755"},"html":{"href":"https://github.com/dlang/phobos/pull/4755"},"issue":{"href":"https://api.github.com/repos/dlang/phobos/issues/4755"},"comments":{"href":"https://api.github.com/repos/dlang/phobos/issues/4755/comments"},"review_comments":{"href":"https://api.github.com/repos/dlang/phobos/pulls/4755/comments"},"review_comment":{"href":"https://api.github.com/repos/dlang/phobos/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dlang/phobos/pulls/4755/commits"},"statuses":{"href":"https://api.github.com/repos/dlang/phobos/statuses/986f838f1560a8d8b85559e49cf6d0ac64e5070e"}}}}
{"actor":{"display_login":"andralex"}}