3 ms·
> Array{Number} is totally different from Array{:<Number}, and shouldn’t be allowed, as it is inefficient. Rest of this I disagree with, but this one I just do
by newswasboring 6y ago
> Array{Number} is totally different from Array{:<Number}, and shouldn’t be allowed, as it is inefficient.
Rest of this I disagree with, but this one I just don't understand. Why is it wrong that it's totally different?
Edit: missed a word which changed the meaning of my question
- jakobnissen 6y agoThese are two different types in Julia. The first is an array of numbers. The second is an infinite set of types, namely "all arrays which have Number or a subtype of Number as its element type". There is a distinction, because e.g. `Array{Int32}` is a subtype of the latter, but not the former (because the former is a concrete types that does not have subtypes).
- newswasboring 6y agoBut that seems very fine and specific to me. I don't understand why it shouldn't be allowed to be like this.
- xiphias2 6y agoArray{Number} is an array of objects with unknown type and size, basically an array of pointers with possibly totally different method implementations. Array{:<Number} is when LLVM gets the exact type at compile time and can optimize the code using SSE instructions. You have a factor of 10 between execution, and if you are not experienced, you don't understand why your code is slow and why the garbage collector kicks in so hard.