[julia-users] sub type definitions

2015-01-05 Thread Samuel Colvin
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}

Re: [julia-users] sub type definitions

2015-01-05 Thread Mike Innes
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)

Re: [julia-users] sub type definitions

2015-01-05 Thread Samuel Colvin
Great thanks a lot, now working. -- Samuel Colvin s...@muelcolvin.com, 07801160713 On 5 January 2015 at 18:32, Jacob Quinn quinn.jac...@gmail.com wrote: 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

Re: [julia-users] sub type definitions

2015-01-05 Thread Jacob Quinn
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

Re: [julia-users] sub type definitions

2015-01-05 Thread Mike Innes
Yup, that's the one, my bad On 5 January 2015 at 18:35, Samuel Colvin s...@muelcolvin.com wrote: Great thanks a lot, now working. -- Samuel Colvin s...@muelcolvin.com, 07801160713 On 5 January 2015 at 18:32, Jacob Quinn quinn.jac...@gmail.com wrote: I believe it should actually be: