# Save/load REPL state

**URL:** <https://discourse.julialang.org/t/save-load-repl-state/102433>\
**Category:** General Usage\
**Created:** [August 3, 2023, 4:07am UTC](https://discourse.julialang.org/t/save-load-repl-state/102433 "2023-08-03T04:07:06Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![anon56330260](https://avatars.discourse-cdn.com/v4/letter/a/f07891/32.png) [@anon56330260](https://discourse.julialang.org/u/anon56330260)\
**Post date:** [August 3, 2023, 10:29pm UTC](https://discourse.julialang.org/t/save-load-repl-state/102433/7 "2023-08-03T22:29:41Z")

</div>

That thread was carried under the context of serialization. My point concerned about whether it’s possible to serialize Main in a stable, automatic and safe way, with a focus on compilation latency. Notice that these two concepts (compilation latency and serialization) are largely orthogonal. You can serialize julia values without saving binary codes, vice versa.

I think my conclusion is still no. Workspace is simply a module without package organization. They are constructed by toplevel `include` instead of `import`/`using`. The mechanism is still the same as precompiled module. Programmers are required to take care of non-serializable values (handlers/Task) and prevent them from saving, manually. This is exact what I am talking about in that thread (`it just works as long as you don’t do strange thing`):

> [@What is harder about saving a Julia session via the REPL whenever?](https://discourse.julialang.org/t/what-is-harder-about-saving-a-julia-session-via-the-repl-whenever/82897/10):
>
> So I guess what you want is like this:
> 
> 1. Execute some Julia codes in REPL, which is some function calls to other libraries, for example, `Plots.plot`.
> 2. The compiled binary codes and other necessary serializable runtime metadata are cached.
> 3. The next time you open REPL, you re-execute you script to set up those runtime you don’t want to cache, and then these compiled codes are loaded. You don’t need to recompile them, so a lot of time is saved.
> 
> If this is what you want, then it can be achieved (as long as you don’t save the global and definitions, you can always reexecute them for they take less time compared to compilation). I have a private fork of Julia’s compiler for this kind of binary cache, which utilizes LLVM’s new linking architecture. It indeed works much like what you just said in this thread. And it has all the limitations I mentioned above, it just works as long as you don’t do strange things.

If you are interested, you can actually read my slides `Build System` on this topic, especially slide 14-15. [https://docs.google.com/presentation/d/1wTP\_nnQYiRLHYnrItrUnYsp7zX7q4vWMmhpONd8Ne\_s/edit?usp=sharing](https://docs.google.com/presentation/d/1wTP_nnQYiRLHYnrItrUnYsp7zX7q4vWMmhpONd8Ne_s/edit?usp=sharing) I talk about this problem in depth.

---

_[View the full topic](https://discourse.julialang.org/t/save-load-repl-state/102433)._
