Issue filed: https://github.com/JuliaLang/julia/issues/7302

On Tuesday, June 17, 2014 2:37:59 PM UTC-4, Jack Holland wrote:
>
> Does anyone have an explanation for why a type variable (e.g. Uint64) acts 
> differently when accessed in an array (e.g. [Uint64]) than by itself? 
> Here's some sample code to show what I mean:
>
> import Base.convert
>
> function convert{T1<:Integer, T2<:String}(totype::Type{T1}, value::T2)
>  println("convert: $totype, $value")
>  #parseint(totype, value)
> end
>
> for t in [Uint64]
>  convert(t, "4")
>  convert(Uint64, "4")
>  println(t)
> end
>
> This code prints:
>
> convert: Uint64, 4
> Uint64
>
> As you can see, only the second call to `convert` prints the message. Why 
> isn't the convert method defined above called twice? Why does placing 
> Uint64 in an array change its behavior? Is there something I'm missing here 
> about how for loops or types work in Julia? Is this a bug or intended 
> behavior?
>

Reply via email to