How does REPL helpmode work?

If I type the following:

using REPL
REPL._helpmode( "push!" )

I get the following output:

:(#= /home/flynn/projects/julia/julia-1.1/usr/share/julia/stdlib/v1.1/REPL/src/docview.jl:40 =# (REPL).@repl Base.TTY(RawFD(0x0000000d) open, 0 bytes waiting) push!)

If I call eval on this expression I get the formatted documentation for the push! function.

Can someone explain how this magic happens ? I see nothing in the above expression that looks like it’s extracting the docs from push!

_helpmode returns an expression that calls @repl, which in turn calls repl, which, in the end, searches for the docs of your input string.

To follow those dispatch fiestas you can either use a debugger or just @which every function.

4 Likes

“Dispatch fiestas” :rofl::rofl::rofl:

1 Like