GitHub PullRequestReviewCommentEvent at 2014-09-20 09:25:05
Repository: julia
Actor: timholy
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/JuliaLang/julia/pulls/comments/17818914","id":17818914,"diff_hunk":"@@ -104,17 +104,17 @@ rand(r::MersenneTwister) = dsfmt_genrand_close_open(r.state)\n dsfmt_randui32() = dsfmt_gv_genrand_uint32()\n dsfmt_randui64() = uint64(dsfmt_randui32()) | (uint64(dsfmt_randui32())<<32)\n \n-rand(::Type{Uint8})   = uint8(rand(Uint32))\n-rand(::Type{Uint16})  = uint16(rand(Uint32))\n+rand(::Type{Uint8})   = itrunc(Uint8,rand(Uint32))\n+rand(::Type{Uint16})  = itrunc(Uint16,rand(Uint32))\n rand(::Type{Uint32})  = dsfmt_randui32()\n rand(::Type{Uint64})  = dsfmt_randui64()\n rand(::Type{Uint128}) = uint128(rand(Uint64))<<64 | rand(Uint64)\n \n-rand(::Type{Int8})    = int8(rand(Uint8))\n-rand(::Type{Int16})   = int16(rand(Uint16))\n-rand(::Type{Int32})   = int32(rand(Uint32))\n-rand(::Type{Int64})   = int64(rand(Uint64))\n-rand(::Type{Int128})  = int128(rand(Uint128))\n+rand(::Type{Int8})    = itrunc(Int8,rand(Uint32))","path":"base/random.jl","position":17,"original_position":17,"commit_id":"ec607da4d3b25663487dd8c5e773d661b6bb6054","original_commit_id":"ec607da4d3b25663487dd8c5e773d661b6bb6054","user":{"login":"timholy","id":1525481,"avatar_url":"https://avatars.githubusercontent.com/u/1525481?v=2","gravatar_id":"2989a078f4caff6fb86fa30e59bd9aa9","url":"https://api.github.com/users/timholy","html_url":"https://github.com/timholy","followers_url":"https://api.github.com/users/timholy/followers","following_url":"https://api.github.com/users/timholy/following{/other_user}","gists_url":"https://api.github.com/users/timholy/gists{/gist_id}","starred_url":"https://api.github.com/users/timholy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timholy/subscriptions","organizations_url":"https://api.github.com/users/timholy/orgs","repos_url":"https://api.github.com/users/timholy/repos","events_url":"https://api.github.com/users/timholy/events{/privacy}","received_events_url":"https://api.github.com/users/timholy/received_events","type":"User","site_admin":false},"body":"I'm not surprised you tried. Makes sense then to keep it like this.","created_at":"2014-09-20T09:25:05Z","updated_at":"2014-09-20T09:25:05Z","html_url":"https://github.com/JuliaLang/julia/pull/8420#discussion_r17818914","pull_request_url":"https://api.github.com/repos/JuliaLang/julia/pulls/8420","_links":{"self":{"href":"https://api.github.com/repos/JuliaLang/julia/pulls/comments/17818914"},"html":{"href":"https://github.com/JuliaLang/julia/pull/8420#discussion_r17818914"},"pull_request":{"href":"https://api.github.com/repos/JuliaLang/julia/pulls/8420"}}},"pull_request":{"url":"https://api.github.com/repos/JuliaLang/julia/pulls/8420","id":21524437,"html_url":"https://github.com/JuliaLang/julia/pull/8420","diff_url":"https://github.com/JuliaLang/julia/pull/8420.diff","patch_url":"https://github.com/JuliaLang/julia/pull/8420.patch","issue_url":"https://api.github.com/repos/JuliaLang/julia/issues/8420","number":8420,"state":"open","locked":false,"title":"WIP: checked integer conversions","user":{"login":"JeffBezanson","id":744556,"avatar_url":"https://avatars.githubusercontent.com/u/744556?v=2","gravatar_id":"b4b8db23d8096b722483a57d21b7d65d","url":"https://api.github.com/users/JeffBezanson","html_url":"https://github.com/JeffBezanson","followers_url":"https://api.github.com/users/JeffBezanson/followers","following_url":"https://api.github.com/users/JeffBezanson/following{/other_user}","gists_url":"https://api.github.com/users/JeffBezanson/gists{/gist_id}","starred_url":"https://api.github.com/users/JeffBezanson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JeffBezanson/subscriptions","organizations_url":"https://api.github.com/users/JeffBezanson/orgs","repos_url":"https://api.github.com/users/JeffBezanson/repos","events_url":"https://api.github.com/users/JeffBezanson/events{/privacy}","received_events_url":"https://api.github.com/users/JeffBezanson/received_events","type":"User","site_admin":false},"body":"This is not done yet but ready for discussion at least.\r\n\r\n1. fixes #3759, making arithmetic type-preserving\r\n1. fixes #5413, checking integer truncations\r\n1. also checks signed<->unsigned conversions\r\n\r\n(1) was simple and did not really break much.\r\n(2) was a bit more breaking, but not too bad and leads to clearer code in most cases.\r\n(3) was kind of a disaster and seems to be very annoying.\r\n\r\nThe problem with (3) is that interpreting a 2's complement integer as unsigned is mathematically useful. It also comes up a lot in hashing, random number generation, and when you just want to write a byte to an IO stream.\r\n\r\nI'm not sure yet how to rewrite https://github.com/JuliaLang/julia/blob/ec607da4d3b25663487dd8c5e773d661b6bb6054/base/random.jl#L209 with checked integer conversions. We need to decide how to handle cases like this.\r\n\r\nI think adding these checks is clearly the right thing, but I was surprised at how many legitimate uses of \"unsafe\" integer conversion there were. I added methods to `itrunc` for unsafely truncating integers, but this only handles converting from larger to smaller. We need to figure out what other functions might be needed.","created_at":"2014-09-19T21:16:52Z","updated_at":"2014-09-20T09:25:05Z","closed_at":null,"merged_at":null,"merge_commit_sha":"44cc32007fa385d9b46db37ed38a0046271ecc37","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/JuliaLang/julia/pulls/8420/commits","review_comments_url":"https://api.github.com/repos/JuliaLang/julia/pulls/8420/comments","review_comment_url":"https://api.github.com/repos/JuliaLang/julia/pulls/comments/{number}","comments_url":"https://api.github.com/repos/JuliaLang/julia/issues/8420/comments","statuses_url":"https://api.github.com/repos/JuliaLang/julia/statuses/ec607da4d3b25663487dd8c5e773d661b6bb6054","head":{"label":"JuliaLang:jb/checked_int_trunc","ref":"jb/checked_int_trunc","sha":"ec607da4d3b25663487dd8c5e773d661b6bb6054","user":{"login":"JuliaLang","id":743164,"avatar_url":"https://avatars.githubusercontent.com/u/743164?v=2","gravatar_id":"d57c99557ab0dc0fa44b4c84447d0f15","url":"https://api.github.com/users/JuliaLang","html_url":"https://github.com/JuliaLang","followers_url":"https://api.github.com/users/JuliaLang/followers","following_url":"https://api.github.com/users/JuliaLang/following{/other_user}","gists_url":"https://api.github.com/users/JuliaLang/gists{/gist_id}","starred_url":"https://api.github.com/users/JuliaLang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JuliaLang/subscriptions","organizations_url":"https://api.github.com/users/JuliaLang/orgs","repos_url":"https://api.github.com/users/JuliaLang/repos","events_url":"https://api.github.com/users/JuliaLang/events{/privacy}","received_events_url":"https://api.github.com/users/JuliaLang/received_events","type":"Organization","site_admin":false},"repo":{"id":1644196,"name":"julia","full_name":"JuliaLang/julia","owner":{"login":"JuliaLang","id":743164,"avatar_url":"https://avatars.githubusercontent.com/u/743164?v=2","gravatar_id":"d57c99557ab0dc0fa44b4c84447d0f15","url":"https://api.github.com/users/JuliaLang","html_url":"https://github.com/JuliaLang","followers_url":"https://api.github.com/users/JuliaLang/followers","following_url":"https://api.github.com/users/JuliaLang/following{/other_user}","gists_url":"https://api.github.com/users/JuliaLang/gists{/gist_id}","starred_url":"https://api.github.com/users/JuliaLang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JuliaLang/subscriptions","organizations_url":"https://api.github.com/users/JuliaLang/orgs","repos_url":"https://api.github.com/users/JuliaLang/repos","events_url":"https://api.github.com/users/JuliaLang/events{/privacy}","received_events_url":"https://api.github.com/users/JuliaLang/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/JuliaLang/julia","description":"The Julia Language: A fresh approach to technical computing.","fork":false,"url":"https://api.github.com/repos/JuliaLang/julia","forks_url":"https://api.github.com/repos/JuliaLang/julia/forks","keys_url":"https://api.github.com/repos/JuliaLang/julia/keys{/key_id}","collaborators_url":"https://api.github.com/repos/JuliaLang/julia/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/JuliaLang/julia/teams","hooks_url":"https://api.github.com/repos/JuliaLang/julia/hooks","issue_events_url":"https://api.github.com/repos/JuliaLang/julia/issues/events{/number}","events_url":"https://api.github.com/repos/JuliaLang/julia/events","assignees_url":"https://api.github.com/repos/JuliaLang/julia/assignees{/user}","branches_url":"https://api.github.com/repos/JuliaLang/julia/branches{/branch}","tags_url":"https://api.github.com/repos/JuliaLang/julia/tags","blobs_url":"https://api.github.com/repos/JuliaLang/julia/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/JuliaLang/julia/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/JuliaLang/julia/git/refs{/sha}","trees_url":"https://api.github.com/repos/JuliaLang/julia/git/trees{/sha}","statuses_url":"https://api.github.com/repos/JuliaLang/julia/statuses/{sha}","languages_url":"https://api.github.com/repos/JuliaLang/julia/languages","stargazers_url":"https://api.github.com/repos/JuliaLang/julia/stargazers","contributors_url":"https://api.github.com/repos/JuliaLang/julia/contributors","subscribers_url":"https://api.github.com/repos/JuliaLang/julia/subscribers","subscription_url":"https://api.github.com/repos/JuliaLang/julia/subscription","commits_url":"https://api.github.com/repos/JuliaLang/julia/commits{/sha}","git_commits_url":"https://api.github.com/repos/JuliaLang/julia/git/commits{/sha}","comments_url":"https://api.github.com/repos/JuliaLang/julia/comments{/number}","issue_comment_url":"https://api.github.com/repos/JuliaLang/julia/issues/comments/{number}","contents_url":"https://api.github.com/repos/JuliaLang/julia/contents/{+path}","compare_url":"https://api.github.com/repos/JuliaLang/julia/compare/{base}...{head}","merges_url":"https://api.github.com/repos/JuliaLang/julia/merges","archive_url":"https://api.github.com/repos/JuliaLang/julia/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/JuliaLang/julia/downloads","issues_url":"https://api.github.com/repos/JuliaLang/julia/issues{/number}","pulls_url":"https://api.github.com/repos/JuliaLang/julia/pulls{/number}","milestones_url":"https://api.github.com/repos/JuliaLang/julia/milestones{/number}","notifications_url":"https://api.github.com/repos/JuliaLang/julia/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/JuliaLang/julia/labels{/name}","releases_url":"https://api.github.com/repos/JuliaLang/julia/releases{/id}","created_at":"2011-04-21T07:01:50Z","updated_at":"2014-09-20T00:02:33Z","pushed_at":"2014-09-20T07:20:16Z","git_url":"git://github.com/JuliaLang/julia.git","ssh_url":"git@github.com:JuliaLang/julia.git","clone_url":"https://github.com/JuliaLang/julia.git","svn_url":"https://github.com/JuliaLang/julia","homepage":"http://julialang.org/","size":169476,"stargazers_count":4343,"watchers_count":4343,"language":"Julia","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":885,"mirror_url":null,"open_issues_count":939,"forks":885,"open_issues":939,"watchers":4343,"default_branch":"master"}},"base":{"label":"JuliaLang:master","ref":"master","sha":"7ca8cbdb7c066f3c6f34dd48307c835bc7ed1f19","user":{"login":"JuliaLang","id":743164,"avatar_url":"https://avatars.githubusercontent.com/u/743164?v=2","gravatar_id":"d57c99557ab0dc0fa44b4c84447d0f15","url":"https://api.github.com/users/JuliaLang","html_url":"https://github.com/JuliaLang","followers_url":"https://api.github.com/users/JuliaLang/followers","following_url":"https://api.github.com/users/JuliaLang/following{/other_user}","gists_url":"https://api.github.com/users/JuliaLang/gists{/gist_id}","starred_url":"https://api.github.com/users/JuliaLang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JuliaLang/subscriptions","organizations_url":"https://api.github.com/users/JuliaLang/orgs","repos_url":"https://api.github.com/users/JuliaLang/repos","events_url":"https://api.github.com/users/JuliaLang/events{/privacy}","received_events_url":"https://api.github.com/users/JuliaLang/received_events","type":"Organization","site_admin":false},"repo":{"id":1644196,"name":"julia","full_name":"JuliaLang/julia","owner":{"login":"JuliaLang","id":743164,"avatar_url":"https://avatars.githubusercontent.com/u/743164?v=2","gravatar_id":"d57c99557ab0dc0fa44b4c84447d0f15","url":"https://api.github.com/users/JuliaLang","html_url":"https://github.com/JuliaLang","followers_url":"https://api.github.com/users/JuliaLang/followers","following_url":"https://api.github.com/users/JuliaLang/following{/other_user}","gists_url":"https://api.github.com/users/JuliaLang/gists{/gist_id}","starred_url":"https://api.github.com/users/JuliaLang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JuliaLang/subscriptions","organizations_url":"https://api.github.com/users/JuliaLang/orgs","repos_url":"https://api.github.com/users/JuliaLang/repos","events_url":"https://api.github.com/users/JuliaLang/events{/privacy}","received_events_url":"https://api.github.com/users/JuliaLang/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/JuliaLang/julia","description":"The Julia Language: A fresh approach to technical computing.","fork":false,"url":"https://api.github.com/repos/JuliaLang/julia","forks_url":"https://api.github.com/repos/JuliaLang/julia/forks","keys_url":"https://api.github.com/repos/JuliaLang/julia/keys{/key_id}","collaborators_url":"https://api.github.com/repos/JuliaLang/julia/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/JuliaLang/julia/teams","hooks_url":"https://api.github.com/repos/JuliaLang/julia/hooks","issue_events_url":"https://api.github.com/repos/JuliaLang/julia/issues/events{/number}","events_url":"https://api.github.com/repos/JuliaLang/julia/events","assignees_url":"https://api.github.com/repos/JuliaLang/julia/assignees{/user}","branches_url":"https://api.github.com/repos/JuliaLang/julia/branches{/branch}","tags_url":"https://api.github.com/repos/JuliaLang/julia/tags","blobs_url":"https://api.github.com/repos/JuliaLang/julia/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/JuliaLang/julia/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/JuliaLang/julia/git/refs{/sha}","trees_url":"https://api.github.com/repos/JuliaLang/julia/git/trees{/sha}","statuses_url":"https://api.github.com/repos/JuliaLang/julia/statuses/{sha}","languages_url":"https://api.github.com/repos/JuliaLang/julia/languages","stargazers_url":"https://api.github.com/repos/JuliaLang/julia/stargazers","contributors_url":"https://api.github.com/repos/JuliaLang/julia/contributors","subscribers_url":"https://api.github.com/repos/JuliaLang/julia/subscribers","subscription_url":"https://api.github.com/repos/JuliaLang/julia/subscription","commits_url":"https://api.github.com/repos/JuliaLang/julia/commits{/sha}","git_commits_url":"https://api.github.com/repos/JuliaLang/julia/git/commits{/sha}","comments_url":"https://api.github.com/repos/JuliaLang/julia/comments{/number}","issue_comment_url":"https://api.github.com/repos/JuliaLang/julia/issues/comments/{number}","contents_url":"https://api.github.com/repos/JuliaLang/julia/contents/{+path}","compare_url":"https://api.github.com/repos/JuliaLang/julia/compare/{base}...{head}","merges_url":"https://api.github.com/repos/JuliaLang/julia/merges","archive_url":"https://api.github.com/repos/JuliaLang/julia/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/JuliaLang/julia/downloads","issues_url":"https://api.github.com/repos/JuliaLang/julia/issues{/number}","pulls_url":"https://api.github.com/repos/JuliaLang/julia/pulls{/number}","milestones_url":"https://api.github.com/repos/JuliaLang/julia/milestones{/number}","notifications_url":"https://api.github.com/repos/JuliaLang/julia/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/JuliaLang/julia/labels{/name}","releases_url":"https://api.github.com/repos/JuliaLang/julia/releases{/id}","created_at":"2011-04-21T07:01:50Z","updated_at":"2014-09-20T00:02:33Z","pushed_at":"2014-09-20T07:20:16Z","git_url":"git://github.com/JuliaLang/julia.git","ssh_url":"git@github.com:JuliaLang/julia.git","clone_url":"https://github.com/JuliaLang/julia.git","svn_url":"https://github.com/JuliaLang/julia","homepage":"http://julialang.org/","size":169476,"stargazers_count":4343,"watchers_count":4343,"language":"Julia","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":885,"mirror_url":null,"open_issues_count":939,"forks":885,"open_issues":939,"watchers":4343,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/JuliaLang/julia/pulls/8420"},"html":{"href":"https://github.com/JuliaLang/julia/pull/8420"},"issue":{"href":"https://api.github.com/repos/JuliaLang/julia/issues/8420"},"comments":{"href":"https://api.github.com/repos/JuliaLang/julia/issues/8420/comments"},"review_comments":{"href":"https://api.github.com/repos/JuliaLang/julia/pulls/8420/comments"},"review_comment":{"href":"https://api.github.com/repos/JuliaLang/julia/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/JuliaLang/julia/pulls/8420/commits"},"statuses":{"href":"https://api.github.com/repos/JuliaLang/julia/statuses/ec607da4d3b25663487dd8c5e773d661b6bb6054"}}}}