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

small ambiguity in zero-arg array constructors #24778

Closed
Sacha0 opened this issue Nov 25, 2017 · 2 comments
Closed

small ambiguity in zero-arg array constructors #24778

Sacha0 opened this issue Nov 25, 2017 · 2 comments
Labels
arrays [a, r, r, a, y, s]

Comments

@Sacha0
Copy link
Member

Sacha0 commented Nov 25, 2017

Array{T}(), which constructs an uninitialized zero-dimensional Array of T, seems slightly ambiguous given the existence of the zero-argument Vector constructors Array{T,1}()/Vector[{T}](). (That is, Array{T}() seems ambiguous as opposed to the explicit Array{T,0}().) This slight ambiguity tripped me up a number of times while working on the Array(shape...) -> Array(uninitialized, shape...) transition. Thoughts? Thanks!

@Sacha0 Sacha0 added the arrays [a, r, r, a, y, s] label Nov 25, 2017
@Sacha0
Copy link
Member Author

Sacha0 commented Nov 25, 2017

I suppose Array{T}() is the integer-series-accepting equivalent of Array{T}(()) / the base case for integer-series-accepting Array constructors. With the Array(shape...) -> Array(uninitialized, shape...) transition (ref. #24595), the tuple form Array{T}(()) becomes Array{T}(uninitialized, ()), and the higher-dimensional integer-series-accepting form Array{T}(ints...) becomes Array{T}(uninitialized, ints...), leaving Array{T}() an odd case. Array{T}(uninitialized) would be the consistent replacement. Thoughts?

@Sacha0
Copy link
Member Author

Sacha0 commented Nov 25, 2017

Investigating a bit further reveals that, in the Array(shape...) -> Array(uninitialized, shape...) deprecation, Array{T}() will automatically deprecate to Array{T}(uninitialized) alongside the other constructors in that family, making this ambiguity negligible. Hence closing. Thanks all!

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]
Projects
None yet
Development

No branches or pull requests

1 participant