I am configuring the automatic start of
OhMyREPL.jl. The document advise putting the following code in the
atreplinit() do repl
@eval using OhMyREPL
println("OhMyREPL imported") # I add this line
@warn "error while importing OhMyREPL" e
Now I have some questions on this code:
- Why do I have to write the
try...catch...end code segment into the
atreplinit() do repl...end?
- Why do I have to add an
using OhMyREPL but unnecessarily do that before
Thanks for response!
In my first question I actually want to know why is the
atreplinit() do repl ... end block necessary?
From the docs
Register a one-argument function to be called before the REPL interface is initialized in interactive sessions; this is useful to customize the interface. The
argument of f is the REPL object. This function should be called from within the .julia/config/startup.jl initialization file.
It is added so that
OhMyREPL is only loaded when running interactively.
If you are using Julia just to run a script once, like
julia compute_something.jl, then you likely don’t need
OhMyREPL, so the above prevents that.