{"action":"created","comment":{"url":"https://api.github.com/repos/JuliaData/CategoricalArrays.jl/pulls/comments/145656876","pull_request_review_id":70457152,"id":145656876,"diff_hunk":"@@ -3,21 +3,21 @@ import Base: convert, getindex, setindex!, similar, in\n ## Constructors and converters\n ## (special methods for AbstractArray{Union{T, Null}}, to avoid wrapping nulls inside CategoricalValues)\n \n-CategoricalArray{Union{T, Null}, N, R}(dims::NTuple{N,Int}; ordered=false) where {T, N, R} =\n+CategoricalArray{Union{T, Null}, N, R}(dims::NTuple{N,Int}; ordered=false) where {T, N, R<:Integer} =\n     CategoricalArray{Union{T, Null}, N, R}(zeros(R, dims), CategoricalPool{T, R}(ordered))\n \n-CategoricalArray{Union{CategoricalValue{T, R}, Null}, N, R}(dims::NTuple{N,Int};\n-                                                                      ordered=false) where {T, N, R} =\n-    CategoricalArray{Union{T, Null}, N, R}(dims; ordered=ordered)\n-CategoricalArray{Union{CategoricalValue{T}, Null}, N, R}(dims::NTuple{N,Int};\n-                                                                   ordered=false) where {T, N, R} =\n-    CategoricalArray{Union{T, Null}, N, R}(dims; ordered=ordered)\n-CategoricalArray{Union{CategoricalValue{T, R}, Null}, N}(dims::NTuple{N,Int};\n-                                                                   ordered=false) where {T, N, R} =\n-    CategoricalArray{Union{T, Null}, N, R}(dims; ordered=ordered)\n-CategoricalArray{Union{CategoricalValue{T}, Null}, N}(dims::NTuple{N,Int};\n-                                                                ordered=false) where {T, N} =\n-    CategoricalArray{Union{T, Null}, N}(dims; ordered=ordered)\n+function CategoricalArray{Union{T, Null}, N, R}(dims::NTuple{N,Int};\n+                                                ordered=false) where {T<:CatValue, N, R<:Integer}\n+    V = unwrap_catvalue_type(T)\n+    CategoricalArray{Union{V, Null}, N, R}(zeros(R, dims), CategoricalPool{V, R, T}(ordered))","path":"src/nullablearray.jl","position":23,"original_position":23,"commit_id":"74cc7c6ae7a0e320797bb2067e87d4f0b8cbb34a","original_commit_id":"74cc7c6ae7a0e320797bb2067e87d4f0b8cbb34a","user":{"login":"nalimilan","id":1120448,"avatar_url":"https://avatars3.githubusercontent.com/u/1120448?v=4","gravatar_id":"","url":"https://api.github.com/users/nalimilan","html_url":"https://github.com/nalimilan","followers_url":"https://api.github.com/users/nalimilan/followers","following_url":"https://api.github.com/users/nalimilan/following{/other_user}","gists_url":"https://api.github.com/users/nalimilan/gists{/gist_id}","starred_url":"https://api.github.com/users/nalimilan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nalimilan/subscriptions","organizations_url":"https://api.github.com/users/nalimilan/orgs","repos_url":"https://api.github.com/users/nalimilan/repos","events_url":"https://api.github.com/users/nalimilan/events{/privacy}","received_events_url":"https://api.github.com/users/nalimilan/received_events","type":"User","site_admin":false},"body":"Here too better use `CategoricalArray{Union{V, Null}, N, R}(dims, ordered=ordered)`.","created_at":"2017-10-19T10:14:22Z","updated_at":"2017-10-19T10:28:42Z","html_url":"https://github.com/JuliaData/CategoricalArrays.jl/pull/87#discussion_r145656876","pull_request_url":"https://api.github.com/repos/JuliaData/CategoricalArrays.jl/pulls/87","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/JuliaData/CategoricalArrays.jl/pulls/comments/145656876"},"html":{"href":"https://github.com/JuliaData/CategoricalArrays.jl/pull/87#discussion_r145656876"},"pull_request":{"href":"https://api.github.com/repos/JuliaData/CategoricalArrays.jl/pulls/87"}}},"pull_request":{"url":"https://api.github.com/repos/JuliaData/CategoricalArrays.jl/pulls/87","id":147431683,"html_url":"https://github.com/JuliaData/CategoricalArrays.jl/pull/87","diff_url":"https://github.com/JuliaData/CategoricalArrays.jl/pull/87.diff","patch_url":"https://github.com/JuliaData/CategoricalArrays.jl/pull/87.patch","issue_url":"https://api.github.com/repos/JuliaData/CategoricalArrays.jl/issues/87","number":87,"state":"open","locked":false,"title":"[WIP/RFC] Allow arbitrary \"categorical value\" types","user":{"login":"alyst","id":348591,"avatar_url":"https://avatars2.githubusercontent.com/u/348591?v=4","gravatar_id":"","url":"https://api.github.com/users/alyst","html_url":"https://github.com/alyst","followers_url":"https://api.github.com/users/alyst/followers","following_url":"https://api.github.com/users/alyst/following{/other_user}","gists_url":"https://api.github.com/users/alyst/gists{/gist_id}","starred_url":"https://api.github.com/users/alyst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alyst/subscriptions","organizations_url":"https://api.github.com/users/alyst/orgs","repos_url":"https://api.github.com/users/alyst/repos","events_url":"https://api.github.com/users/alyst/events{/privacy}","received_events_url":"https://api.github.com/users/alyst/received_events","type":"User","site_admin":false},"body":"To transparently support string data, string categorical value type need to be inherited from `AbstractString`, which would conflict with the other categorical types (e.g. numeric) if all are implemented by the same `CategoricalValue{T, R}`.\r\nBased on the discussions in #77, I put this very early draft of the changes that allow `AbstractString` inheritance and dispatch for the string categories, while preserving the old behavior for any other categorical types.\r\nPlease give your early feedback on the approach taken.\r\n\r\nThis PR allows `CategoricalArray` to use arbitrary categorical value type and introduces `CategoricalString{R} <: AbstractString` to be used by default for `String` categorical values (`CategoricalValue{T,R}` is used for the rest).\r\nBoth `CategoricalString` and `CategoricalValue` should support \"categorical value\" concept, which currently requires to \"iscatvalue/pool/level/valtype/reftype()\" methods.\r\n\r\nSince `CategoricalValue` and `CategoricalString` are not relatives, `CatValue = Union{CategoricalValue, CategoricalString}` is introduced to reduce the dispatch rules.\r\nThis is not a very good design as `CatValue` definition would have to be updated for each new \"categorical value\" implementation, making external categorical value types not possible.\r\nHowever, it should be possible to avoid `CatValue` by employing categorical value traits (dispatching by the result of `iscatvalue(T)`).","created_at":"2017-10-18T23:03:40Z","updated_at":"2017-10-19T10:28:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8d1e130627facadbedc0bf12d9a8517f9a1f444a","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/JuliaData/CategoricalArrays.jl/pulls/87/commits","review_comments_url":"https://api.github.com/repos/JuliaData/CategoricalArrays.jl/pulls/87/comments","review_comment_url":"https://api.github.com/repos/JuliaData/CategoricalArrays.jl/pulls/comments{/number}","comments_url":"https://api.github.com/repos/JuliaData/CategoricalArrays.jl/issues/87/comments","statuses_url":"https://api.github.com/repos/JuliaData/CategoricalArrays.jl/statuses/74cc7c6ae7a0e320797bb2067e87d4f0b8cbb34a","head":{"label":"alyst:cat_string","ref":"cat_string","sha":"74cc7c6ae7a0e320797bb2067e87d4f0b8cbb34a","user":{"login":"alyst","id":348591,"avatar_url":"https://avatars2.githubusercontent.com/u/348591?v=4","gravatar_id":"","url":"https://api.github.com/users/alyst","html_url":"https://github.com/alyst","followers_url":"https://api.github.com/users/alyst/followers","following_url":"https://api.github.com/users/alyst/following{/other_user}","gists_url":"https://api.github.com/users/alyst/gists{/gist_id}","starred_url":"https://api.github.com/users/alyst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alyst/subscriptions","organizations_url":"https://api.github.com/users/alyst/orgs","repos_url":"https://api.github.com/users/alyst/repos","events_url":"https://api.github.com/users/alyst/events{/privacy}","received_events_url":"https://api.github.com/users/alyst/received_events","type":"User","site_admin":false},"repo":{"id":69562311,"name":"CategoricalArrays.jl","full_name":"alyst/CategoricalArrays.jl","owner":{"login":"alyst","id":348591,"avatar_url":"https://avatars2.githubusercontent.com/u/348591?v=4","gravatar_id":"","url":"https://api.github.com/users/alyst","html_url":"https://github.com/alyst","followers_url":"https://api.github.com/users/alyst/followers","following_url":"https://api.github.com/users/alyst/following{/other_user}","gists_url":"https://api.github.com/users/alyst/gists{/gist_id}","starred_url":"https://api.github.com/users/alyst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alyst/subscriptions","organizations_url":"https://api.github.com/users/alyst/orgs","repos_url":"https://api.github.com/users/alyst/repos","events_url":"https://api.github.com/users/alyst/events{/privacy}","received_events_url":"https://api.github.com/users/alyst/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/alyst/CategoricalArrays.jl","description":"Arrays for working with categorical data (both nominal and ordinal) in Julia","fork":true,"url":"https://api.github.com/repos/alyst/CategoricalArrays.jl","forks_url":"https://api.github.com/repos/alyst/CategoricalArrays.jl/forks","keys_url":"https://api.github.com/repos/alyst/CategoricalArrays.jl/keys{/key_id}","collaborators_url":"https://api.github.com/repos/alyst/CategoricalArrays.jl/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/alyst/CategoricalArrays.jl/teams","hooks_url":"https://api.github.com/repos/alyst/CategoricalArrays.jl/hooks","issue_events_url":"https://api.github.com/repos/alyst/CategoricalArrays.jl/issues/events{/number}","events_url":"https://api.github.com/repos/alyst/CategoricalArrays.jl/events","assignees_url":"https://api.github.com/repos/alyst/CategoricalArrays.jl/assignees{/user}","branches_url":"https://api.github.com/repos/alyst/CategoricalArrays.jl/branches{/branch}","tags_url":"https://api.github.com/repos/alyst/CategoricalArrays.jl/tags","blobs_url":"https://api.github.com/repos/alyst/CategoricalArrays.jl/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/alyst/CategoricalArrays.jl/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/alyst/CategoricalArrays.jl/git/refs{/sha}","trees_url":"https://api.github.com/repos/alyst/CategoricalArrays.jl/git/trees{/sha}","statuses_url":"https://api.github.com/repos/alyst/CategoricalArrays.jl/statuses/{sha}","languages_url":"https://api.github.com/repos/alyst/CategoricalArrays.jl/languages","stargazers_url":"https://api.github.com/repos/alyst/CategoricalArrays.jl/stargazers","contributors_url":"https://api.github.com/repos/alyst/CategoricalArrays.jl/contributors","subscribers_url":"https://api.github.com/repos/alyst/CategoricalArrays.jl/subscribers","subscription_url":"https://api.github.com/repos/alyst/CategoricalArrays.jl/subscription","commits_url":"https://api.github.com/repos/alyst/CategoricalArrays.jl/commits{/sha}","git_commits_url":"https://api.github.com/repos/alyst/CategoricalArrays.jl/git/commits{/sha}","comments_url":"https://api.github.com/repos/alyst/CategoricalArrays.jl/comments{/number}","issue_comment_url":"https://api.github.com/repos/alyst/CategoricalArrays.jl/issues/comments{/number}","contents_url":"https://api.github.com/repos/alyst/CategoricalArrays.jl/contents/{+path}","compare_url":"https://api.github.com/repos/alyst/CategoricalArrays.jl/compare/{base}...{head}","merges_url":"https://api.github.com/repos/alyst/CategoricalArrays.jl/merges","archive_url":"https://api.github.com/repos/alyst/CategoricalArrays.jl/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/alyst/CategoricalArrays.jl/downloads","issues_url":"https://api.github.com/repos/alyst/CategoricalArrays.jl/issues{/number}","pulls_url":"https://api.github.com/repos/alyst/CategoricalArrays.jl/pulls{/number}","milestones_url":"https://api.github.com/repos/alyst/CategoricalArrays.jl/milestones{/number}","notifications_url":"https://api.github.com/repos/alyst/CategoricalArrays.jl/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/alyst/CategoricalArrays.jl/labels{/name}","releases_url":"https://api.github.com/repos/alyst/CategoricalArrays.jl/releases{/id}","deployments_url":"https://api.github.com/repos/alyst/CategoricalArrays.jl/deployments","created_at":"2016-09-29T11:45:38Z","updated_at":"2016-09-29T11:45:40Z","pushed_at":"2017-10-18T22:42:46Z","git_url":"git://github.com/alyst/CategoricalArrays.jl.git","ssh_url":"git@github.com:alyst/CategoricalArrays.jl.git","clone_url":"https://github.com/alyst/CategoricalArrays.jl.git","svn_url":"https://github.com/alyst/CategoricalArrays.jl","homepage":"","size":438,"stargazers_count":0,"watchers_count":0,"language":"Julia","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"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":"JuliaData:master","ref":"master","sha":"4cf4e2185ee7e7f4a3339021ed01b335587ba45a","user":{"login":"JuliaData","id":20142970,"avatar_url":"https://avatars3.githubusercontent.com/u/20142970?v=4","gravatar_id":"","url":"https://api.github.com/users/JuliaData","html_url":"https://github.com/JuliaData","followers_url":"https://api.github.com/users/JuliaData/followers","following_url":"https://api.github.com/users/JuliaData/following{/other_user}","gists_url":"https://api.github.com/users/JuliaData/gists{/gist_id}","starred_url":"https://api.github.com/users/JuliaData/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JuliaData/subscriptions","organizations_url":"https://api.github.com/users/JuliaData/orgs","repos_url":"https://api.github.com/users/JuliaData/repos","events_url":"https://api.github.com/users/JuliaData/events{/privacy}","received_events_url":"https://api.github.com/users/JuliaData/received_events","type":"Organization","site_admin":false},"repo":{"id":58399306,"name":"CategoricalArrays.jl","full_name":"JuliaData/CategoricalArrays.jl","owner":{"login":"JuliaData","id":20142970,"avatar_url":"https://avatars3.githubusercontent.com/u/20142970?v=4","gravatar_id":"","url":"https://api.github.com/users/JuliaData","html_url":"https://github.com/JuliaData","followers_url":"https://api.github.com/users/JuliaData/followers","following_url":"https://api.github.com/users/JuliaData/following{/other_user}","gists_url":"https://api.github.com/users/JuliaData/gists{/gist_id}","starred_url":"https://api.github.com/users/JuliaData/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JuliaData/subscriptions","organizations_url":"https://api.github.com/users/JuliaData/orgs","repos_url":"https://api.github.com/users/JuliaData/repos","events_url":"https://api.github.com/users/JuliaData/events{/privacy}","received_events_url":"https://api.github.com/users/JuliaData/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/JuliaData/CategoricalArrays.jl","description":"Arrays for working with categorical data (both nominal and ordinal) in Julia","fork":false,"url":"https://api.github.com/repos/JuliaData/CategoricalArrays.jl","forks_url":"https://api.github.com/repos/JuliaData/CategoricalArrays.jl/forks","keys_url":"https://api.github.com/repos/JuliaData/CategoricalArrays.jl/keys{/key_id}","collaborators_url":"https://api.github.com/repos/JuliaData/CategoricalArrays.jl/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/JuliaData/CategoricalArrays.jl/teams","hooks_url":"https://api.github.com/repos/JuliaData/CategoricalArrays.jl/hooks","issue_events_url":"https://api.github.com/repos/JuliaData/CategoricalArrays.jl/issues/events{/number}","events_url":"https://api.github.com/repos/JuliaData/CategoricalArrays.jl/events","assignees_url":"https://api.github.com/repos/JuliaData/CategoricalArrays.jl/assignees{/user}","branches_url":"https://api.github.com/repos/JuliaData/CategoricalArrays.jl/branches{/branch}","tags_url":"https://api.github.com/repos/JuliaData/CategoricalArrays.jl/tags","blobs_url":"https://api.github.com/repos/JuliaData/CategoricalArrays.jl/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/JuliaData/CategoricalArrays.jl/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/JuliaData/CategoricalArrays.jl/git/refs{/sha}","trees_url":"https://api.github.com/repos/JuliaData/CategoricalArrays.jl/git/trees{/sha}","statuses_url":"https://api.github.com/repos/JuliaData/CategoricalArrays.jl/statuses/{sha}","languages_url":"https://api.github.com/repos/JuliaData/CategoricalArrays.jl/languages","stargazers_url":"https://api.github.com/repos/JuliaData/CategoricalArrays.jl/stargazers","contributors_url":"https://api.github.com/repos/JuliaData/CategoricalArrays.jl/contributors","subscribers_url":"https://api.github.com/repos/JuliaData/CategoricalArrays.jl/subscribers","subscription_url":"https://api.github.com/repos/JuliaData/CategoricalArrays.jl/subscription","commits_url":"https://api.github.com/repos/JuliaData/CategoricalArrays.jl/commits{/sha}","git_commits_url":"https://api.github.com/repos/JuliaData/CategoricalArrays.jl/git/commits{/sha}","comments_url":"https://api.github.com/repos/JuliaData/CategoricalArrays.jl/comments{/number}","issue_comment_url":"https://api.github.com/repos/JuliaData/CategoricalArrays.jl/issues/comments{/number}","contents_url":"https://api.github.com/repos/JuliaData/CategoricalArrays.jl/contents/{+path}","compare_url":"https://api.github.com/repos/JuliaData/CategoricalArrays.jl/compare/{base}...{head}","merges_url":"https://api.github.com/repos/JuliaData/CategoricalArrays.jl/merges","archive_url":"https://api.github.com/repos/JuliaData/CategoricalArrays.jl/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/JuliaData/CategoricalArrays.jl/downloads","issues_url":"https://api.github.com/repos/JuliaData/CategoricalArrays.jl/issues{/number}","pulls_url":"https://api.github.com/repos/JuliaData/CategoricalArrays.jl/pulls{/number}","milestones_url":"https://api.github.com/repos/JuliaData/CategoricalArrays.jl/milestones{/number}","notifications_url":"https://api.github.com/repos/JuliaData/CategoricalArrays.jl/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/JuliaData/CategoricalArrays.jl/labels{/name}","releases_url":"https://api.github.com/repos/JuliaData/CategoricalArrays.jl/releases{/id}","deployments_url":"https://api.github.com/repos/JuliaData/CategoricalArrays.jl/deployments","created_at":"2016-05-09T18:36:12Z","updated_at":"2017-10-14T06:56:33Z","pushed_at":"2017-10-18T23:03:41Z","git_url":"git://github.com/JuliaData/CategoricalArrays.jl.git","ssh_url":"git@github.com:JuliaData/CategoricalArrays.jl.git","clone_url":"https://github.com/JuliaData/CategoricalArrays.jl.git","svn_url":"https://github.com/JuliaData/CategoricalArrays.jl","homepage":"","size":544,"stargazers_count":14,"watchers_count":14,"language":"Julia","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":12,"mirror_url":null,"open_issues_count":12,"forks":12,"open_issues":12,"watchers":14,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/JuliaData/CategoricalArrays.jl/pulls/87"},"html":{"href":"https://github.com/JuliaData/CategoricalArrays.jl/pull/87"},"issue":{"href":"https://api.github.com/repos/JuliaData/CategoricalArrays.jl/issues/87"},"comments":{"href":"https://api.github.com/repos/JuliaData/CategoricalArrays.jl/issues/87/comments"},"review_comments":{"href":"https://api.github.com/repos/JuliaData/CategoricalArrays.jl/pulls/87/comments"},"review_comment":{"href":"https://api.github.com/repos/JuliaData/CategoricalArrays.jl/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/JuliaData/CategoricalArrays.jl/pulls/87/commits"},"statuses":{"href":"https://api.github.com/repos/JuliaData/CategoricalArrays.jl/statuses/74cc7c6ae7a0e320797bb2067e87d4f0b8cbb34a"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"nalimilan"}}