-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NTuple as a type parameter is not invariant #6561
Comments
I'm not really sure this should work for either Tuple or NTuple, given that Julia's type parameters are invariant. Passing a julia> foo(convert(Vector{Tuple}, [(1,2), (3,4)])) (although oddly |
I don't quite understand why an explicit |
@simonster is quite right.
|
Any explanation of why it is working with NTuple will be helpful. |
Must be a bug. |
The following certainly explains your behaviour: typeof([(1,2), (3,4)]) # returns Array{(Int64,Int64),1} or thus Vector{(Int64,Int64)}
Vector{(Int64,Int64)} <: Vector{Tuple} # returns false and I do indeed remember from reading somewhere that it is not because Vector{(Int64,Int64)} <: Vector{NTuple} # returns true fits in this behaviour. I would think only the following strategy could work: typealias TupleVector{N,T} Vector{NTuple{N,T}}
Vector{(Int64,Int64)} <: TupleVector # returns true |
This used to work, doesn't now.
NTuple
instead ofTuple
dispatches fine.The text was updated successfully, but these errors were encountered: