Julia: TypeVars in tuples in type parameters

Created on 1 Dec 2016  Â·  3Comments  Â·  Source: JuliaLang/julia

julia> type Foo{N} end

julia> Foo{(true, true)}
Foo{(true,true)}

julia> typealias Bar{N} Foo{N}
Foo{N}

julia> Bar{(true, true)}
Foo{(true,true)}

julia> typealias Baz Foo{(true, true)}
Foo{(true,true)}

julia> typealias Quuz{M, N} Foo{(M, N)}
TypeError: Foo: in parameter, expected Type{T}, got Tuple{TypeVar,TypeVar}

Yes, those are supposed to be tuples and not tuple types. I blame @Keno (https://github.com/Keno/Cxx.jl/blob/master/src/cxxtypes.jl#L52).

I fully expect this to be unsupported, but I hope that gets @Keno to change (true, false, false) to Tuple{Val{true}, Val{false}, Val{false}} in Cxx.jl.

types and dispatch won't change

All 3 comments

In my defense those used to be one and the same.

That's legit. I'm also digging into Cxx implementation details in order to dispatch on Cxx types, which maybe you hoped people wouldn't do.

Tuple{true, false, false} also works (although slightly weird since it can't actually be the type of anything).

Closing as wontfix, since I don't think we're planning to be able to quantify over tuples.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tkoolen picture tkoolen  Â·  3Comments

thofma picture thofma  Â·  3Comments

StefanKarpinski picture StefanKarpinski  Â·  3Comments

helgee picture helgee  Â·  3Comments

StefanKarpinski picture StefanKarpinski  Â·  3Comments