Where can I find the API docs of type X?

Hi there,
where can I find the API of a given class from the stdlib, e.g. what are the fields, methods and the hierarchy of a DataType ?

In REPL you can write ? NameOfType to read the docstring of that type. Many user facing types will have common usage examples and such there.

For package types, you can read the package docs, most often there’s a badge in the GitHub readme. For base types there’s the Julia docs (e.g. arrays).

But because Julia is not OOP, you can’t have a complete documentation of the “methods of a type”.

1 Like

methodswith, subtypes, and supertypes are functions that you can use to explore a type.

1 Like

Note that methodswith is not guaranteed to catch every method that applies. For instance

filter(a -> a.name===:^, methodswith(Int64))

doesn’t return the method that corresponds to 2^4. Because that one is not specialized for Int64 in source.

1 Like

You could always check filter(a -> a.name===:^, methodswith(Int64, supertypes = true)) instead, but that gets very unwieldy very quickly.

Yes. Depending on whether you count supertypes, methodswith will probably miss many methods that you would expect to be listed in the api for an OOP type, or list many that would not. It follows from the Julia principle of not overly constraining functions.