I'd just like to add that this behavior is a real downer when dealing with 
strings, too. During testing/debugging inline strings are ASCIIStrings, but 
I don't want to hardcode my functions to use ASCIIStrings (or have to make 
Unions absolutely every place I want a vector of strings):

julia> f(strs::Vector{String}) = dump(strs)
f (generic function with 1 method)

julia> f(["foo"])
ERROR: no method f(Array{ASCIIString,1})

julia> g(strs::Vector{UTF8String}) = dump(strs)
g (generic function with 1 method)

julia> g(["foo"])
ERROR: no method g(Array{ASCIIString,1})

julia> h(strs::Vector{ASCIIString}) = dump(strs)
h (generic function with 1 method)

julia> h(["foo"])
Array(ASCIIString,(1,)) ASCIIString["foo"]



On Sunday, May 25, 2014 11:46:43 AM UTC-4, Pierre-Yves Gérardy wrote:
>
>
>
> On Sunday, May 25, 2014 5:44:26 PM UTC+2, Pierre-Yves Gérardy wrote:
>>
>> On Sunday, May 25, 2014 5:10:49 PM UTC+2, James Crist wrote:
>>>
>>> Yeah, that's what I've been using. My issue with it is that the 
>>> declarations get long for functions with more than 2 arrays. Was hoping 
>>> there was a more concise way.
>>>
>>
>> You can use  typealias Fp FloatingPoint , then
>>
>  
> ... or  Fp = FloatingPoint , types are first class objects.
>  
>
>>  
>>
> function foo{T1<:Fp, T2<:Fp}(a::Array{T1}, b::Array{T2}) 
>>
>>

Reply via email to