Lost type information in nested tuples?


#1

Zips of several items result in iterator states which are nested tuples. I have a line in my code_warntype which looks like this:

s@_7::Tuple{Int64,Tuple{Int64,Tuple{Int64,Tuple{Int64,Tuple}}}} = (Base.Iterators.tuple)(1, (Base.Iterators.tuple)(1, (Base.Iterators.tu
ple)(1, (Core.tuple)(1, (Core.tuple)(itr@_8::Base.OneTo{Int64}, 1)::Tuple{Base.OneTo{Int64},Int64})::Tuple{Int64,Tuple{Base.OneTo{Int64},Int64
}})::Tuple{Int64,Tuple{Int64,Tuple{Base.OneTo{Int64},Int64}}})::Tuple{Int64,Tuple{Int64,Tuple{Int64,Tuple{Base.OneTo{Int64},Int64}}}})::Tuple{
Int64,Tuple{Int64,Tuple{Int64,Tuple{Int64,Tuple{Base.OneTo{Int64},Int64}}}}}

What seems to be going on is because the type is so nested that inference gives up? Is that what’s actually happening? If it is the case it means that zips of more than 4 or 5 things will be type unstable. Does that mean that we need a new version of zip that doesn’t need so many nested types? Or will the new optimizer take care of it?

Note this is on 0.6.


#2

PS why are zips implemented as a nested tuple of iterators rather than just a tuple of iterators?