On Thu, May 07 2015, Mauro <[email protected]> wrote:

> Where `Type` is special is with respect to `isa` and thus method
> dispatch where this works:
>
> julia> bar{T}(::Type{T}) = T
> bar (generic function with 1 method)
>
> julia> bar(Int)
> Int64
>
> julia> isa(Int, Type{Int})
> true
>
> I think there is some special handling of Type to make that possible.
> As of course, I can't replicate this myself:
>
> [...]
>
> I think the `isa(Int, Type{Int}) == true` is hard-coded somewhere in the
> internals of Julia.  For normal instances this holds:

I think that this is a key point, and if indeed this is true then the
issue is much clearer --- Type is just special.

> julia> isa(5,Int)
> true
>
> implies
>
> julia> typeof(5)<:Int
> true
>
>> 2. how does this square with invariance? or that doesn't apply to types?
>
> Note sure I understand this.

Now I am not sure what I was thinking when I asked that question :D

Thanks for the explanation!

Best,

Tamas

Reply via email to