Open bjarthur opened 3 years ago
This is gonna be slightly annoying to implement. In the meantime I'd recommend @doc
:
julia> foo(x) = @infiltrate
foo (generic function with 1 method)
julia> foo(3)
Infiltrating foo(x::Int64) at REPL[2]:1:
infil> @doc sin
sin(x)
Compute sine of x, where x is in radians.
sin(A::AbstractMatrix)
Compute the matrix sine of a square matrix A.
If A is symmetric or Hermitian, its eigendecomposition (eigen) is used to compute the sine. Otherwise, the sine is
determined by calling exp.
Examples
≡≡≡≡≡≡≡≡≡≡
julia> sin(fill(1.0, (2,2)))
2×2 Matrix{Float64}:
0.454649 0.454649
0.454649 0.454649
hah! nice. that suffices. i did not know about @doc
. maybe document in the REPL help? it is not mentioned there:
infil> ?
Code entered is evaluated in the current functions module. Note that you cannot change local
variables, but can assign to globals in a permanent store module.
The following commands are special cased:
- `?`: Print this help text.
- `@trace`: Print the current stack trace.
- `@locals`: Print local variables.
- `@exfiltrate`: Save all local variables into the store.
- `@toggle`: Toggle infiltrating at this `@infiltrate` spot (clear all with `Infiltrator.clear_disabled!()`).
- `@continue`: Continue to the next infiltration point or exit (shortcut: Ctrl-D).
- `@exit`: Stop infiltrating for the remainder of this session and exit (on Julia versions prior to
1.5 this needs to be manually cleared with `Infiltrator.end_session!()`).
That's because it's not specific to Infiltrator at all (the same works in the normal REPL). But yes, adding a note can't hurt: https://github.com/JuliaDebug/Infiltrator.jl/commit/bc6fbcfd36f1f68a2bdccf24c3f0f6e9bb0ec9f6
would be convenient if docstrings could be accessed in the usual way with
?
at the infiltrator prompt. not sure how hard this would be to implement though.