{"action":"closed","issue":{"url":"https://api.github.com/repos/JuliaLang/julia/issues/9419","labels_url":"https://api.github.com/repos/JuliaLang/julia/issues/9419/labels{/name}","comments_url":"https://api.github.com/repos/JuliaLang/julia/issues/9419/comments","events_url":"https://api.github.com/repos/JuliaLang/julia/issues/9419/events","html_url":"https://github.com/JuliaLang/julia/issues/9419","id":52555633,"number":9419,"title":"allow `getindex(::MyType, ::Colon)` to be customized","user":{"login":"rfourquet","id":8462914,"avatar_url":"https://avatars.githubusercontent.com/u/8462914?v=3","gravatar_id":"","url":"https://api.github.com/users/rfourquet","html_url":"https://github.com/rfourquet","followers_url":"https://api.github.com/users/rfourquet/followers","following_url":"https://api.github.com/users/rfourquet/following{/other_user}","gists_url":"https://api.github.com/users/rfourquet/gists{/gist_id}","starred_url":"https://api.github.com/users/rfourquet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rfourquet/subscriptions","organizations_url":"https://api.github.com/users/rfourquet/orgs","repos_url":"https://api.github.com/users/rfourquet/repos","events_url":"https://api.github.com/users/rfourquet/events{/privacy}","received_events_url":"https://api.github.com/users/rfourquet/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2014-12-20T07:20:55Z","updated_at":"2015-06-12T00:29:12Z","closed_at":"2015-06-12T00:29:12Z","body":"And similarly for `setindex!`.\r\nFor example:\r\n```\r\ntype A end\r\nBase.getindex(a::A, ::Range) = 0\r\nBase.getindex(a::A, ::Colon) = 1\r\n\r\njulia> A()[:]\r\nERROR: `endof` has no method matching endof(::A)\r\n```\r\nThis is worse if `endof(::A)` is defined, as then `A()[:]` chooses silently the unintended `getindex` method.\r\n\r\nIf allowing customization of `Base.getindex(a::A, ::Colon)` does not happen, I would request that `a[:]` is translated to `a[beginof(a):endof(a)]`, as some indexable collections have an indice starting at something else than 1.\r\n\r\nAt the very least, the doc for `getindex/setindex!` should mention this special case, where \"The syntax `a[i,j,...]` is converted by the compiler to `getindex(a, i, j, ...)`\" does not seem true.\r\n\r\nAlso, in \"base/subarray.jl\", this method is defined: `getindex{T}(v::AbstractArray{T,1}, ::Colon) = v`, should it be removed or is it used?"}}