I didn't know about NTuple. It's not a typical TypeConstructor, made with 
typealias. It's a core type, implemented in jltypes.c, and you've found a 
bug. Let's look more closely.

julia> snoop(x)=(println(x, " ", typeof(x)); x)
julia> type ftest{T}
     data::f(NTuple{T,Int})
  end
NTuple{T,Int64} DataType
NTuple{T,Int64} DataType

julia> x=ftest{2}((1,2)) # This is how it normally works.
(Int64,Int64) (DataType,DataType)

julia> x=ftest{Float64}((1,2)) # And the goof.
NTuple{Float64,Int64} DataType
julia> x.data
(1,2)

There is a loop in jl_type_intersect 
<https://github.com/JuliaLang/julia/blob/fd60ca35965545086d83dc437c40d88afa7a9bf7/src/jltypes.c#L833>,
 
where it finds the length of the tuple. It initializes to the length of the 
actual tuple, then looks for a length, and doesn't throw an error if it 
fails to find one. It's my first time looking there, but, you know, HTH.

Drew

Reply via email to