REPL and mainloop

I have been thinking a little bit about the issue that Gtk makes the REPL sluggish on windows and from my perspective this points at a little bit more general problem: How should one integrate an external mainloop with the REPL?

For context: If one runs a Gtk program in Python / C / … the last statement is a call to Gtk.main(), which is blocking and gives control to the mainloop. So in theory we could do the same and would be done.

But if we think about things like a plotting window one is actually interested in keeping the REPL alive and still allow the UI to render. An example here is Winston.jl. My question now is somewhat: Has someone an idea howto solve this properly? Is this something Gtk.jl can actually handle or is this a job for the REPL code? One rough idea would be to allow that the REPL runs on a different thread while the main thread runs the Gtk mainloop. What currently happens can be seen here:

So a task is created and seems to compete with the REPL.

1 Like