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}
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)
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
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
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: