Skip to content

How does the suggestion for including in startup.jl work ? #34

@ArbitRandomUser

Description

@ArbitRandomUser

the suggested method is to add

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

now if we look at line 393 in client.jl we see

373  function run_main_repl(interacti
 ...
 ...
393 │   │   │   _atreplinit(active_repl)                                                       
394 │   │   │   REPL.run_repl(active_repl, backend->(global active_repl_backend = backend))    

_atreplinit gets called before REPL.run_repl ,
now there are lines inside initrepl like .. julia_mode = active_repl.interface.modes[1] will only work after
REPL.run_repl has run (right?) .

My question is .. how is @async making this happen ?
is this a "hack" such that run_repl is able to setup_interface and all other initializations that initrepl needs before @async initrepl is accessing them , what if the async reaches something(for eg line 68 julia_mode = ...) that has not been initialized by REPL.run yet ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions