I may be dense here, but on older julias (pre #10380?) one can do this:
julia> foo{T<:FloatingPoint}(t::(String,Type{T})) = 1
foo (generic function with 1 method)
julia> foo(("hi",Float32))
1
julia> foo(("hi",Int))
ERROR: `foo` has no method matching foo(::(ASCIIString,DataType))
but on current 0.4
julia> foo{T<:FloatingPoint}(t::Tuple{AbstractString,Type{T}}) = 1
foo (generic function with 1 method)
julia> foo(("hi",Float32))
ERROR: MethodError: `foo` has no method matching foo(::Tuple{ASCIIString,DataType})
Closest candidates are:
foo{T<:FloatingPoint}(::Tuple{AbstractString,Type{T<:FloatingPoint}})
One can do
julia> foo(t::Tuple{AbstractString,DataType}) = _foo(t[1], t[2])
foo (generic function with 1 method)
julia> _foo{T<:FloatingPoint}(filename::AbstractString, ::Type{T}) = 1
_foo (generic function with 1 method)
but it's not quite as convenient. Bug, or just the way it's gonna be?
I have formerly used the (filename, T) construct as a way of signaling to algorithms that they should use mmap_array rather than Array for allocating their output (because the output will be too big otherwise).
I may be dense here, but on older julias (pre #10380?) one can do this:
but on current 0.4
One can do
but it's not quite as convenient. Bug, or just the way it's gonna be?
I have formerly used the
(filename, T)construct as a way of signaling to algorithms that they should usemmap_arrayrather thanArrayfor allocating their output (because the output will be too big otherwise).