Yup, that's the one, my bad On 5 January 2015 at 18:35, Samuel Colvin <[email protected]> wrote:
> Great thanks a lot, now working. > > > -- > > Samuel Colvin > [email protected], > 07801160713 > > On 5 January 2015 at 18:32, Jacob Quinn <[email protected]> wrote: > >> I believe it should actually be: >> >> func{T<:Foo}(bar::Type{T}) ... >> >> On Mon, Jan 5, 2015 at 11:30 AM, Mike Innes <[email protected]> >> wrote: >> >>> func{T<:Foo}(bar::T) >>> >>> should do what you want, I think >>> >>> On 5 January 2015 at 18:28, Samuel Colvin <[email protected]> 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? >>>> >>> >>> >> >
