Yes, there is methodswith(t::Type)
On Monday, February 24, 2014 4:25:55 PM UTC+1, David Salamon wrote: > > related question: is there a way to see all the methods that involve a > given datatype? > > kind of the inverse of methods(foo)? > > > On Mon, Feb 24, 2014 at 6:55 AM, Iain Dunning <iaind...@gmail.com<javascript:> > > wrote: > >> One way to do it is >> >> abstract Parent >> >> method1(p::Parent) = error("Children must implement this or face an >> error!") >> >> For an example of this at larger scale, check out >> https://github.com/JuliaOpt/MathProgBase.jl/blob/master/src/MathProgSolverInterface.jl >> >> On Monday, February 24, 2014 8:29:09 AM UTC-5, Joosep Pata wrote: >> >>> Similarly, I have wondered what methods should an AbstractDataFrame >>> implement. Do we have a mechanism of specifying the interface of an >>> abstract type? >>> 24.02.2014 15:00 kirjutas kuupƤeval "Johan Sigfrids" < >>> johan.s...@gmail.com>: >>> >>> This is actually a really good question. I found myself wondering the >>>> same thing the other day. >>>> >>>> On Monday, February 24, 2014 1:54:59 PM UTC+2, andrew cooke wrote: >>>>> >>>>> Working on the finite field code I found myself asking "what is a >>>>> Number?". >>>>> >>>>> One answer is: >>>>> >>>>> julia> Base.subtypetree(Number) >>>>> (Number,{(Complex{Float16},{}),(Complex{Float32},{}),(Complex{Float64 >>>>> },{}),(Complex{T<:Real},{}),(Real,{(FloatingPoint,{(BigFloat,{}),( >>>>> Float16,{}),(Float32,{}),(Float64,{})}),(Integer,{(BigInt,{}),(Bool >>>>> ,{}),(Char,{}),(Signed,{(Int128,{}),(Int16,{}),(Int32,{}),(Int64,{}),( >>>>> Int8,{})}),(Unsigned,{(Uint128,{}),(Uint16,{}),(Uint32,{}),(Uint64 >>>>> ,{}),(Uint8,{})})}),(MathConst{sym},{}),(Rational{T<:Integer},{})})}) >>>>> >>>>> but that doesn't help so much. What I really wanted to know is - what >>>>> methods are assumed to exist for something that is a subtype of Number? >>>>> >>>>> And I don't know how to answer that. >>>>> >>>>> Maybe (I don't think so) Julia needs some kind of concept like >>>>> abstract methods, where you can name methods for Number that any subtype >>>>> must implement? >>>>> >>>>> Maybe there needs to be some kind of tool that introspects the code >>>>> base and says "90% of subtypes define real and abs"? >>>>> >>>>> Maybe this has already been discussed or is clearly not an issue? >>>>> >>>>> Andrew >>>>> >>>> >