@Mason Protter
How does the
atreplinit() suggestion in the readme work ?
atreplinit() do repl
try
@eval using ReplMaker
@async initrepl(
apropos;
prompt_text="search> ",
prompt_color=:magenta,
start_key=')',
mode_name="search_mode"
)
catch
end
end
end
what i dont understand is why it works with the @async .
while the _atreplinit is being executed in client.jl, the Base.active_repl is not defined right ?
why does then this work with @async ? is this sort of 'relying on a race condition` that Base.active_repl gets
defined before that line in the async is reached ?
edit: okay Base.active_repl isdefined , but not fully instantiated with interfaces and modes ,
either way my question is are we relying on them being instantiated before the @async tries to reach them ?
, alright .. i dont understand this ..
suppose i have this in my startup.jl ...
atreplinit() do repl
@eval using ReplMaker
@show methods(initrepl)
initrepl(
apropos;
prompt_text="search> ",
prompt_color=:magenta,
start_key=')',
mode_name="search_mode"
)
end
and then i start a repl . i get this error ..
└── julia
_
_ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.7.2 (2022-02-06)
_/ |\__'_|_|_|\__'_| | Official https://julialang.org/ release
|__/ |
methods(initrepl) = # 1 method for generic function "initrepl":
[1] initrepl(parser::Function; prompt_text, prompt_color, start_key, repl, mode_name, show_function, show_function_io, valid_input_checker, keymap, completion_provider, sticky_mode, startup_text) in ReplMaker at /home/antineutrino/.julia/packages/ReplMaker/ViCwA/src/ReplMaker.jl:42
MethodError: no method matching initrepl(::typeof(apropos); prompt_text="search> ", prompt_color=:magenta, start_key=')', mode_name="search_mode")
Closest candidates are:
initrepl(::Function; prompt_text, prompt_color, start_key, repl, mode_name, show_function, show_function_io, valid_input_checker, keymap, completion_provider, sticky_mode, startup_text) at ~/.julia/packages/ReplMaker/ViCwA/src/ReplMaker.jl:42
julia>
that exact method exists , as shown by @show . but it still complains of no method matching .. closes candidates which is the same method :thinking:
tl;dr , why the @async
Last updated: Nov 06 2024 at 04:40 UTC