I'm a relatively new Julia user, but as I've been getting used to the Julia 
type system my confusion over what's going on with Array type parameters 
has only grown.

Whereas most type parameters are types themselves, Arrays can take integer 
valued type parameters. Is it true, more generally, that Julia allows 
parameters to take on arbitrary values? For example, is there some sort of 
syntax to declare other types, of my own creation, that also have integer 
valued type parameters?

I am additionally confused by the partial specification of Arrays type 
parameters, seen when entering Array{Int} into REPL which returns the type 
Array{Int, N}.  This partial specification is also understood by the type 
hierarchy, as Array{T,2} <: Array{T}. This seems to violate the otherwise 
invariant type hierarchy in Julia, which makes me wonder if this behavior 
is explicitly defined, or does it come from some other mechanism? For 
example, is there someplace in Base defining something along the lines of:

abstract Array{T}
abstract Array{T, N} <: Array{T}
call(::Type{Array{T}}, x...) = Array{T,length(x)}(x...)

I tried poking around the arrays.jl file in Base but couldn't figure out 
the answer to these questions. Thanks in advance!

Reply via email to