Interactive Utilities

Base.Docs.aproposFunction
apropos([io::IO=stdout], pattern::Union{AbstractString,Regex})

Search available docstrings for entries containing pattern.

When pattern is a string, case is ignored. Results are printed to io.

source
InteractiveUtils.varinfoFunction
varinfo(m::Module=Main, pattern::Regex=r""; all::Bool = false, imported::Bool = false, sortby::Symbol = :name)

Return a markdown table giving information about exported global variables in a module, optionally restricted to those matching pattern.

The memory consumption estimate is an approximate lower bound on the size of the internal structure of the object.

  • all : also list non-exported objects defined in the module, deprecated objects, and compiler-generated objects.
  • imported : also list objects explicitly imported from other modules.
  • recursive : recursively include objects in sub-modules, observing the same settings in each.
  • sortby : the column to sort results by. Options are :name (default), :size, and :summary.
source
InteractiveUtils.versioninfoFunction
versioninfo(io::IO=stdout; verbose::Bool=false)

Print information about the version of Julia in use. The output is controlled with boolean keyword arguments:

  • verbose: print all additional information

See also: VERSION.

source
InteractiveUtils.methodswithFunction
methodswith(typ[, module or function]; supertypes::Bool=false])

Return an array of methods with an argument of type typ.

The optional second argument restricts the search to a particular module or function (the default is all top-level modules).

If keyword supertypes is true, also return arguments with a parent type of typ, excluding type Any.

source
InteractiveUtils.subtypesFunction
subtypes(T::DataType)

Return a list of immediate subtypes of DataType T. Note that all currently loaded subtypes are included, including those not visible in the current module.

See also supertype, supertypes, methodswith.

Examples

julia> subtypes(Integer)
3-element Vector{Any}:
 Bool
 Signed
 Unsigned
source
InteractiveUtils.editMethod
edit(path::AbstractString, line::Integer=0)

Edit a file or directory optionally providing a line number to edit the file at. Return to the julia prompt when you quit the editor. The editor can be changed by setting JULIA_EDITOR, VISUAL or EDITOR as an environment variable.

See also: define_editor

source
InteractiveUtils.editMethod
edit(function, [types])
edit(module)

Edit the definition of a function, optionally specifying a tuple of types to indicate which method to edit. For modules, open the main source file. The module needs to be loaded with using or import first.

Julia 1.1

edit on modules requires at least Julia 1.1.

To ensure that the file can be opened at the given line, you may need to call define_editor first.

source
InteractiveUtils.@editMacro
@edit

Evaluates the arguments to the function or macro call, determines their types, and calls the edit function on the resulting expression.

See also: @less, @which.

source
InteractiveUtils.lessMethod
less(file::AbstractString, [line::Integer])

Show a file using the default pager, optionally providing a starting line number. Returns to the julia prompt when you quit the pager.

source
InteractiveUtils.lessMethod
less(function, [types])

Show the definition of a function using the default pager, optionally specifying a tuple of types to indicate which method to see.

source
InteractiveUtils.@whichMacro
@which

Applied to a function or macro call, it evaluates the arguments to the specified call, and returns the Method object for the method that would be called for those arguments. Applied to a variable, it returns the module in which the variable was bound. It calls out to the which function.

See also: @less, @edit.

source
InteractiveUtils.@functionlocMacro
@functionloc

Applied to a function or macro call, it evaluates the arguments to the specified call, and returns a tuple (filename,line) giving the location for the method that would be called for those arguments. It calls out to the functionloc function.

source
InteractiveUtils.@code_typedMacro
@code_typed

Evaluates the arguments to the function or macro call, determines their types, and calls code_typed on the resulting expression. Use the optional argument optimize with

@code_typed optimize=true foo(x)

to control whether additional optimizations, such as inlining, are also applied.

source
InteractiveUtils.code_warntypeFunction
code_warntype([io::IO], f, types; debuginfo=:default)

Prints lowered and type-inferred ASTs for the methods matching the given generic function and type signature to io which defaults to stdout. The ASTs are annotated in such a way as to cause "non-leaf" types to be emphasized (if color is available, displayed in red). This serves as a warning of potential type instability. Not all non-leaf types are particularly problematic for performance, so the results need to be used judiciously. In particular, unions containing either missing or nothing are displayed in yellow, since these are often intentional.

Keyword argument debuginfo may be one of :source or :none (default), to specify the verbosity of code comments.

See @code_warntype for more information.

source
InteractiveUtils.code_llvmFunction
code_llvm([io=stdout,], f, types; raw=false, dump_module=false, optimize=true, debuginfo=:default)

Prints the LLVM bitcodes generated for running the method matching the given generic function and type signature to io.

If the optimize keyword is unset, the code will be shown before LLVM optimizations. All metadata and dbg.* calls are removed from the printed bitcode. For the full IR, set the raw keyword to true. To dump the entire module that encapsulates the function (with declarations), set the dump_module keyword to true. Keyword argument debuginfo may be one of source (default) or none, to specify the verbosity of code comments.

source
InteractiveUtils.@code_llvmMacro
@code_llvm

Evaluates the arguments to the function or macro call, determines their types, and calls code_llvm on the resulting expression. Set the optional keyword arguments raw, dump_module, debuginfo, optimize by putting them and their value before the function call, like this:

@code_llvm raw=true dump_module=true debuginfo=:default f(x)
@code_llvm optimize=false f(x)

optimize controls whether additional optimizations, such as inlining, are also applied. raw makes all metadata and dbg.* calls visible. debuginfo may be one of :source (default) or :none, to specify the verbosity of code comments. dump_module prints the entire module that encapsulates the function.

source
InteractiveUtils.code_nativeFunction
code_native([io=stdout,], f, types; syntax=:att, debuginfo=:default)

Prints the native assembly instructions generated for running the method matching the given generic function and type signature to io. Switch assembly syntax using syntax symbol parameter set to :att for AT&T syntax or :intel for Intel syntax. Keyword argument debuginfo may be one of source (default) or none, to specify the verbosity of code comments.

source
InteractiveUtils.@code_nativeMacro
@code_native

Evaluates the arguments to the function or macro call, determines their types, and calls code_native on the resulting expression.

Set the optional keyword argument debuginfo by putting it before the function call, like this:

@code_native debuginfo=:default f(x)

debuginfo may be one of :source (default) or :none, to specify the verbosity of code comments.

source
InteractiveUtils.clipboardFunction
clipboard(x)

Send a printed form of x to the operating system clipboard ("copy").

source
clipboard() -> AbstractString

Return a string with the contents of the operating system clipboard ("paste").

source