Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Array{T,N}(n...) should work for any N #18459

Closed
simonster opened this issue Sep 12, 2016 · 4 comments
Closed

Array{T,N}(n...) should work for any N #18459

simonster opened this issue Sep 12, 2016 · 4 comments
Labels
arrays [a, r, r, a, y, s] good first issue Indicates a good issue for first-time contributors to Julia Hacktoberfest Good for Hacktoberfest participants

Comments

@simonster
Copy link
Member

simonster commented Sep 12, 2016

Right now, you can do Array{T,1}(n) and Array{T,2}(n1, n2) but not Array{T,3}(n1, n2, n3) (although Array{T}(n1, n2, n3) and Array{T,3}((n1, n2, n3)) both work). This is inconsistent and potentially surprising. It should be possible to make all constructors of this form work using bound varargs.

@simonster simonster added help wanted Indicates that a maintainer wants help on an issue or pull request good first issue Indicates a good issue for first-time contributors to Julia and removed help wanted Indicates that a maintainer wants help on an issue or pull request labels Sep 12, 2016
@yuyichao
Copy link
Contributor

Ref #14201, which was AFAIK the last time this came up.

@pkofod
Copy link
Contributor

pkofod commented Sep 13, 2016

Currently building to test locally first (from fresh clone, so...), but is it something like

(::Type{Array{T,N}}){T,N}(d::Vararg{Int, N}) = ccall(:jl_new_array, Array{T,N}, (Any,Any), Array{T,N}, d)

right?

@SanketDG
Copy link

SanketDG commented Sep 16, 2016

Was this fixed in #18475?

@kshyatt kshyatt added the Hacktoberfest Good for Hacktoberfest participants label Oct 5, 2016
@yuyichao yuyichao changed the title Array{T,N)(n...) should work for any N Array{T,N}(n...) should work for any N Nov 4, 2016
@yuyichao
Copy link
Contributor

yuyichao commented Nov 4, 2016

Yes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arrays [a, r, r, a, y, s] good first issue Indicates a good issue for first-time contributors to Julia Hacktoberfest Good for Hacktoberfest participants
Projects
None yet
Development

No branches or pull requests

5 participants