What is the type 'Method' and where is it defined?

The @which macro returns a mutable composite type Method. Is this documented anywhere and how do I find the source code for it? I guess it is part of the Julia internals since the usual ways of discovery fail.

m = @which length([1.0])
typeof(m)
@which Method
methods(Method)

Yes, it’s an internal type. You can find many of Julia’s internals documented via comments in base/boot.jl; the closer they are to the compiler the less likely they seem to be to be spelled out. The authoritative source is julia.h, and the Julia “mirror” is created in jltypes.c.

5 Likes

Also, there are some docs at

https://docs.julialang.org/en/v1.6-dev/devdocs/ast/#ast-lowered-method

1 Like