{"action":"created","issue":{"url":"https://api.github.com/repos/JuliaLang/julia/issues/7799","labels_url":"https://api.github.com/repos/JuliaLang/julia/issues/7799/labels{/name}","comments_url":"https://api.github.com/repos/JuliaLang/julia/issues/7799/comments","events_url":"https://api.github.com/repos/JuliaLang/julia/issues/7799/events","html_url":"https://github.com/JuliaLang/julia/issues/7799","id":39177282,"number":7799,"title":"extensible bounds checking removal","user":{"login":"ivarne","id":131616,"avatar_url":"https://avatars.githubusercontent.com/u/131616?v=3","gravatar_id":"","url":"https://api.github.com/users/ivarne","html_url":"https://github.com/ivarne","followers_url":"https://api.github.com/users/ivarne/followers","following_url":"https://api.github.com/users/ivarne/following{/other_user}","gists_url":"https://api.github.com/users/ivarne/gists{/gist_id}","starred_url":"https://api.github.com/users/ivarne/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ivarne/subscriptions","organizations_url":"https://api.github.com/users/ivarne/orgs","repos_url":"https://api.github.com/users/ivarne/repos","events_url":"https://api.github.com/users/ivarne/events{/privacy}","received_events_url":"https://api.github.com/users/ivarne/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/JuliaLang/julia/milestones/11","html_url":"https://github.com/JuliaLang/julia/milestones/0.4.0","labels_url":"https://api.github.com/repos/JuliaLang/julia/milestones/11/labels","id":748886,"number":11,"title":"0.4.0","description":"For tracking release-defining items for 0.4: important new features, breaking changes, and blocking bugs.\r\n\r\nAfter a brief period for deciding scope, adding issues to this milestone is not allowed. Once the items in this milestone are done, 0.4 will enter its stabilizing period and a release candidate can be made soon after.","creator":{"login":"JeffBezanson","id":744556,"avatar_url":"https://avatars.githubusercontent.com/u/744556?v=3","gravatar_id":"","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},"open_issues":9,"closed_issues":53,"state":"open","created_at":"2014-08-10T18:13:46Z","updated_at":"2015-06-28T02:04:03Z","due_on":"2015-06-20T18:30:00Z","closed_at":null},"comments":31,"created_at":"2014-07-31T09:22:50Z","updated_at":"2015-06-29T12:38:27Z","closed_at":null,"body":"For user written short functions that have a huge overhead from bounds checking, it would be nice if it was possible to hook into the `boundscheck` system with `@inbounds` in order to let the user be able to disable manual bounds checking inside the function.\r\n\r\nThis might be beneficial for `SubString`, `SubArray`, and many wrapping types that have to check bounds before forwarding to the internal storage.\r\n\r\nOne suggestion is to have a `@bounds` macro that you can wrap the optional checking code in, but that seems somewhat brittle.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/JuliaLang/julia/issues/comments/116641306","html_url":"https://github.com/JuliaLang/julia/issues/7799#issuecomment-116641306","issue_url":"https://api.github.com/repos/JuliaLang/julia/issues/7799","id":116641306,"user":{"login":"timholy","id":1525481,"avatar_url":"https://avatars.githubusercontent.com/u/1525481?v=3","gravatar_id":"","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},"created_at":"2015-06-29T12:38:27Z","updated_at":"2015-06-29T12:38:27Z","body":"The advantage of this proposal is that it's composable: checking bounds is a conceptually separate step from retrieving/setting data, and consequently it makes sense to separate the two pieces. The default `getindex` will catch 95% of cases. Likewise, if the implementation's access of memory is via `B[indx]` for some `B` internal to the type, then `julia --checkbounds=yes` will catch problems even if the author sprinkles `@inbounds` everywhere. Since one can use direct pointer arithmetic in Julia, it will always be possible to write code that can segfault, but I don't think that's a problem---anyone who uses such shenanigans is taking matters into their own hands.\r\n\r\nAnd yes, checkbounds should be checking that the index along dimension `d` is between 1 and `size(A,d)`. But there are cases where this may not be sufficient. An example might be if you want to construct something like a SubArray that does not use bounds-checking upon construction, but is careful to check whenever indexes are used---you'd want to check both the index and the index-to-the-index."}}