{"action":"created","issue":{"url":"https://api.github.com/repos/JuliaLang/julia/issues/11557","labels_url":"https://api.github.com/repos/JuliaLang/julia/issues/11557/labels{/name}","comments_url":"https://api.github.com/repos/JuliaLang/julia/issues/11557/comments","events_url":"https://api.github.com/repos/JuliaLang/julia/issues/11557/events","html_url":"https://github.com/JuliaLang/julia/issues/11557","id":84414487,"number":11557,"title":"Functions that return arrays with eltype as an input should use fully parameterized container type instead?","user":{"login":"tkelman","id":5934628,"avatar_url":"https://avatars.githubusercontent.com/u/5934628?v=3","gravatar_id":"","url":"https://api.github.com/users/tkelman","html_url":"https://github.com/tkelman","followers_url":"https://api.github.com/users/tkelman/followers","following_url":"https://api.github.com/users/tkelman/following{/other_user}","gists_url":"https://api.github.com/users/tkelman/gists{/gist_id}","starred_url":"https://api.github.com/users/tkelman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tkelman/subscriptions","organizations_url":"https://api.github.com/users/tkelman/orgs","repos_url":"https://api.github.com/users/tkelman/repos","events_url":"https://api.github.com/users/tkelman/events{/privacy}","received_events_url":"https://api.github.com/users/tkelman/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/JuliaLang/julia/labels/breaking","name":"breaking","color":"800000"},{"url":"https://api.github.com/repos/JuliaLang/julia/labels/decision","name":"decision","color":"F08000"},{"url":"https://api.github.com/repos/JuliaLang/julia/labels/speculative","name":"speculative","color":"999999"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-06-03T07:40:01Z","updated_at":"2015-06-03T08:02:20Z","closed_at":null,"body":"ref https://github.com/JuliaLang/julia/pull/11280#issuecomment-108221468 and a few other places I've mentioned this. Functions like `zeros`, `ones`, `eye`, `rand`, `mmap` (maybe), etc which currently take an `eltype` as inputs and return some subtype of `AbstractArray`, would be much more general if they instead took the container type (with element type as a parameter) as input, so the current case would instead look like `zeros(Array{Float64}, dims...)`. This would allow extending these functions to other types of `AbstractArray` in a much nicer way than right now. We could potentially get rid of a bunch of ugly-named functions like `bitrand` and `spzeros` and `speye` and `sprandbool` with this change.\r\n\r\n~~I think it would by necessity be breaking, though maybe clever enough subtyping of `zeros{T<:AbstractArray}(::Type{T}, dims...)` would allow putting in deprecations (or defaults? might be fragile) for \"scalar\" types, if we have enough of a concept of interfaces to determine what makes a type a scalar (that's a different issue).~~\r\n\r\nThis would have to be a breaking change for arrays-of-arrays (if any of these functions currently work for arrays of arrays, that is?)."},"comment":{"url":"https://api.github.com/repos/JuliaLang/julia/issues/comments/108237121","html_url":"https://github.com/JuliaLang/julia/issues/11557#issuecomment-108237121","issue_url":"https://api.github.com/repos/JuliaLang/julia/issues/11557","id":108237121,"user":{"login":"tkelman","id":5934628,"avatar_url":"https://avatars.githubusercontent.com/u/5934628?v=3","gravatar_id":"","url":"https://api.github.com/users/tkelman","html_url":"https://github.com/tkelman","followers_url":"https://api.github.com/users/tkelman/followers","following_url":"https://api.github.com/users/tkelman/following{/other_user}","gists_url":"https://api.github.com/users/tkelman/gists{/gist_id}","starred_url":"https://api.github.com/users/tkelman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tkelman/subscriptions","organizations_url":"https://api.github.com/users/tkelman/orgs","repos_url":"https://api.github.com/users/tkelman/repos","events_url":"https://api.github.com/users/tkelman/events{/privacy}","received_events_url":"https://api.github.com/users/tkelman/received_events","type":"User","site_admin":false},"created_at":"2015-06-03T08:02:20Z","updated_at":"2015-06-03T08:02:20Z","body":"That doesn't work for things like `rand` and `eye` though, it's a bit narrow-minded and probably well-served already by `fill!`. Completely eliminating `zeros` and `ones` would probably not go over all that well with the linear algebraists among us, though I suppose nothing is guaranteed to be sacred from banishment to `MatlabCompat.jl`, at least not before Julia hits 1.0."}}