{"action":"created","issue":{"url":"https://api.github.com/repos/JuliaLang/julia/issues/14770","labels_url":"https://api.github.com/repos/JuliaLang/julia/issues/14770/labels{/name}","comments_url":"https://api.github.com/repos/JuliaLang/julia/issues/14770/comments","events_url":"https://api.github.com/repos/JuliaLang/julia/issues/14770/events","html_url":"https://github.com/JuliaLang/julia/issues/14770","id":128274438,"number":14770,"title":"keep generalized linear indexing?","user":{"login":"IainNZ","id":692635,"avatar_url":"https://avatars.githubusercontent.com/u/692635?v=3","gravatar_id":"","url":"https://api.github.com/users/IainNZ","html_url":"https://github.com/IainNZ","followers_url":"https://api.github.com/users/IainNZ/followers","following_url":"https://api.github.com/users/IainNZ/following{/other_user}","gists_url":"https://api.github.com/users/IainNZ/gists{/gist_id}","starred_url":"https://api.github.com/users/IainNZ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/IainNZ/subscriptions","organizations_url":"https://api.github.com/users/IainNZ/orgs","repos_url":"https://api.github.com/users/IainNZ/repos","events_url":"https://api.github.com/users/IainNZ/events{/privacy}","received_events_url":"https://api.github.com/users/IainNZ/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/JuliaLang/julia/labels/decision","name":"decision","color":"F08000"},{"url":"https://api.github.com/repos/JuliaLang/julia/labels/multilinear%20algebra","name":"multilinear algebra","color":"006b75"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":49,"created_at":"2016-01-23T00:04:11Z","updated_at":"2016-01-29T18:58:12Z","closed_at":null,"body":"I'm sure this has been discussed elsewhere, but maybe not recently or in a focussed/isolated fashion. If this shouldn't be an issue report, I'll move it to julia-users.\r\n\r\nEssentially, I would say this behavior is surprising:\r\n```\r\njulia> x = reshape(1:3^3, (3,3,3));\r\n\r\njulia> size(x)\r\n(3,3,3)\r\n\r\njulia> x[3,4]\r\n12\r\n```\r\nThis was a cause of a hard-to-find bug for me recently, where I accidentally forgot an index.\r\nI suppose this is in some way a generalization of the fact that `x[12]` works, but I'm not really sure why or where that behavior is useful for 2D-or-higher indices. Is there some logic for the current behavior?\r\n\r\nEDIT: most similar discussion: https://github.com/JuliaLang/julia/issues/5396"},"comment":{"url":"https://api.github.com/repos/JuliaLang/julia/issues/comments/176913113","html_url":"https://github.com/JuliaLang/julia/issues/14770#issuecomment-176913113","issue_url":"https://api.github.com/repos/JuliaLang/julia/issues/14770","id":176913113,"user":{"login":"eschnett","id":213514,"avatar_url":"https://avatars.githubusercontent.com/u/213514?v=3","gravatar_id":"","url":"https://api.github.com/users/eschnett","html_url":"https://github.com/eschnett","followers_url":"https://api.github.com/users/eschnett/followers","following_url":"https://api.github.com/users/eschnett/following{/other_user}","gists_url":"https://api.github.com/users/eschnett/gists{/gist_id}","starred_url":"https://api.github.com/users/eschnett/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eschnett/subscriptions","organizations_url":"https://api.github.com/users/eschnett/orgs","repos_url":"https://api.github.com/users/eschnett/repos","events_url":"https://api.github.com/users/eschnett/events{/privacy}","received_events_url":"https://api.github.com/users/eschnett/received_events","type":"User","site_admin":false},"created_at":"2016-01-29T18:58:12Z","updated_at":"2016-01-29T18:58:12Z","body":"For (2), see e.g. <https://github.com/eschnett/FlexibleArrays.jl>. If you define a 1d-array with index range `0:9`, then indexing it with `M[1:length(M)]` doesn't work. (Of course you still want to be able to index it this way, that's why you need a special syntax.)\r\n\r\nFor (3), my point was \"without explicitly introducing a view\". It doesn't matter whether arrays are built-in or defined in a library. I'm thinking e.g. of Fortran, C, C++, Mathematica, Python. They all allow linear indexing, and all require either a special syntax or construct to use linear indexing with a multi-dimensional array."}}