Giter Club home page Giter Club logo

Comments (12)

tkf avatar tkf commented on May 16, 2024 1

@diegozea I think I solved it in IPython.jl master.

@KristofferC It would be nice if Base has afterreplinit (or something) to wrap what Pkg.jl is doing:

"""
    afterreplinit(f)

Like `atreplinit` but triggers `f` even after REPL is initialized when
it is called.  For `LineEditREPL`, it ensures that `interface` is
initialized.
"""
function afterreplinit(f)
    if isdefined(Base, :active_repl)
        f(Base.active_repl)
    else
        atreplinit() do repl
            if isinteractive() && repl isa REPL.LineEditREPL
                isdefined(repl, :interface) || (repl.interface = REPL.setup_interface(repl))
                f(repl)
            end
        end
    end
end

from packagecompiler.jl.

SimonDanisch avatar SimonDanisch commented on May 16, 2024

I wonder if that's expected, since they're fairly dynamic. @KristofferC, you should know REPL modes pretty well, any ideas?

from packagecompiler.jl.

KristofferC avatar KristofferC commented on May 16, 2024

In Pkg3, we set up the REPL as https://github.com/JuliaLang/Pkg3.jl/blob/bd3802f3738c834f44ccb2d354b2befb0cea4234/src/Pkg3.jl#L55-L66 in __init__. Not sure how RCall does it.

from packagecompiler.jl.

diegozea avatar diegozea commented on May 16, 2024

I think @randy3k will have a better idea of how RCall does it.

from packagecompiler.jl.

randy3k avatar randy3k commented on May 16, 2024

RCall uses this to setup the REPL, I got the idea from @Keno's Cxx.jl, so I assume I was correct...

from packagecompiler.jl.

randy3k avatar randy3k commented on May 16, 2024

@diegozea how about initializing the REPL manually?

RCall.RPrompt.repl_init(Base.active_repl)

from packagecompiler.jl.

KristofferC avatar KristofferC commented on May 16, 2024

I think you need to handle the case when the REPL is not yet inited but the package gets loaded.

from packagecompiler.jl.

randy3k avatar randy3k commented on May 16, 2024

Is there any hook we could use to load the repl code when the repl is ready?

from packagecompiler.jl.

KristofferC avatar KristofferC commented on May 16, 2024

Not a PackageCompiler bug, the package needs to be more robust in how the REPL is started like described in #68 (comment)

from packagecompiler.jl.

tkf avatar tkf commented on May 16, 2024

Can julia runtime help individual packages to solve this problem? I think the way Pkg "solving" this touches too much implementation details of the julia runtime (including the REPL stdlib). I think we need an appropriate hook to cleanly solve this: JuliaLang/julia#29896

from packagecompiler.jl.

KristofferC avatar KristofferC commented on May 16, 2024

Yes, Julia could very well facilitate this. Point here is that it isn't a PackageCompiler issue.

from packagecompiler.jl.

tkf avatar tkf commented on May 16, 2024

I was commenting just because I was worried that #68 (comment) would be regarded as the official correct solution. I am glad that you acknowledge that there can be a better solution.

from packagecompiler.jl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.