I believe it should actually be:

func{T<:Foo}(bar::Type{T}) ...

On Mon, Jan 5, 2015 at 11:30 AM, Mike Innes <mike.j.in...@gmail.com> wrote:

> func{T<:Foo}(bar::T)
>
> should do what you want, I think
>
> On 5 January 2015 at 18:28, Samuel Colvin <samcol...@gmail.com> wrote:
>
>> julia> abstract Foo
>>
>> julia> type SubFoo <: Foo
>>        x
>>        end
>>
>> julia> func(bar::Type{Foo}) = println(bar)
>> func (generic function with 1 method)
>>
>> julia> f=SubFoo(1)
>> SubFoo(1)
>>
>> julia> func(typeof(f))
>> ERROR: `func` has no method matching func(::Type{SubFoo})
>>
>>
>>
>> What do I need to replace "Type{Foo}" with to get this working?
>>
>> I tried "Type{T<:Foo}" and "Type{<:Foo}" but neither worked, I felt I was
>> close though?
>>
>
>

Reply via email to