About acceptable types of dimension parameter for Base.reshape


#1

I think the current behavior of Base.reshape function is a little strange.

a = zeros(100);

reshape(a, 10, 10)  # OK

reshape(a, UInt(10), UInt(10))  # MethodError
reshape(a, (UInt(10), UInt(10)))  # OK

reshape(a, Int128(10), Int128(10))  # MethodError
reshape(a, (Int128(10), Int128(10)))  # OK

Probably it would be ok if reshape() accepts those parameters in both cases. Or am I missing something?


#2

Array indexing and dimensions are based on Int, thus it is a bit strange to use something else. But it would probably be ok to change the definition from

reshape(parent::AbstractArray, dims::Int...) = reshape(parent, dims)

to

reshape(parent::AbstractArray, dims::Integer...) = reshape(parent, dims)

Why don’t you do a PR to find out?


#3

Thank you! I will try.