Please bring workspace() or an equivalent back

From all the discussions I have read about Julia, I have got the impression that you are supposed to use Julia in long sessions than quitting and restarting Julia every now and then. But then the problem faced is an overcrowded workspace. While looking for ways to clear workspace I found that there used to be workspace() command until 0.7 and doesn’t exist anymore. Or are there any workarounds that I’m not aware of?

2 Likes

As workaround type this in your global or user-defined startup.jl file and restart Julia:

function workspace()
  atexit() do
    run(`$(Base.julia_cmd())`)
  end
  exit()
end

It defines a custom “workspace” function that first instructs to open a new Julia function when Julia terminates, and then indeed exits the current Julia process.

Tried this and get an error message:

julia> function workspace()
       atexit() do
       run($(Base.julia_cmd()))
       end
       exit()
       end
ERROR: syntax: "$" expression outside quote

julia> 

The whole point was to not terminate Julia so as to not repeatedly pay the compilation price…

1 Like

Yeah, I personally think we should bring it back as well. We load packages in a different way now which should reduce some of the weirdness associated with workspace back in 0.6

9 Likes

Sorry, I was on my mobile and not giving the code-formatting to the code resulted in the backquotes getting lost in the forum software.
Just use: run(`$(Base.julia_cmd())`) (as a workaround only of course)

Please advocate for adding this much-wanted feature. Without such a function, it is almost impossible to keep using a session for a long time.

1 Like