2016-07-25 6 views
12

私はタイプTを持っていますが、どのようにREPLでこのタイプに特化したすべてのメソッドを取得できますか?私の動機は、Tがパッケージに定義されていて、と私が何を意味するのか分かりにくいかもしれません。Tソースコードからです。要約するとタイプのすべてのメソッドを取得する方法

、私はすでに存在している

functions(T) 

methodsとしてのようなものをしたいと思いますが、それは関数が、私はおよそ

答えて

19

あなたが使用する必要が知りたい必要がmethodswith(T)

help?> methodswith 
search: methodswith 

    methodswith(typ[, module or function][, showparents]) 

    Return an array of methods with an argument of type typ. If optional showparents 
    is true, also return arguments with a parent type of typ, excluding type Any. 

    The optional second argument restricts the search to a particular module or 
    function. 

julia> type Foo end 

julia> methodswith(Foo) 
0-element Array{Method,1} 

julia> foo(::Foo) = nothing 
foo (generic function with 1 method) 

julia> methodswith(Foo) 
1-element Array{Method,1}: 
foo(::Foo) at none:1 
関連する問題