Repl: should `ans` be shared across different prompt modes?

I just lost some data :person_shrugging: because I didn’t think a command executed in shell mode will overwrite my ans. That is my fault, but anyway, should this be the case?

julia> 22.5
22.5

julia> ans
22.5

shell> cal
    January 2025      
Su Mo Tu We Th Fr Sa  
          1  2  3  4  
 5  6  7  8  9 10 11  
12 13 14 15 16 17 18  
19 20 21 22 23 24 25  
26 27 28 29 30 31     
                      

julia> ans

julia>

The same happens in help mode:

julia> 22.5
22.5

julia> ans
22.5

help?> ans
search: ans any as abs ones acos tand rand acsc any! tanh axes nand abs2

  ans

  A variable referring to the last computed value, automatically imported to
  the interactive prompt.

julia> ans
  ans

  A variable referring to the last computed value, automatically imported to
  the interactive prompt.

julia>

but not in Pkg mode:

julia> 22.5
22.5

julia> ans
22.5

(@v1.11) pkg> st
Status `~/.julia/environments/v1.11/Project.toml`
  [4c63d2b9] StatsFuns v1.3.2

julia> ans
22.5

julia> 

my julia version:

julia> versioninfo()
Julia Version 1.11.2
Commit 5e9a32e7af2 (2024-12-01 20:02 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 4 × Intel(R) Core(TM) i5-6300U CPU @ 2.40GHz
  WORD_SIZE: 64
  LLVM: libLLVM-16.0.6 (ORCJIT, skylake)
Threads: 1 default, 0 interactive, 1 GC (on 4 virtual cores)
5 Likes

More fun to try: ans seems to not work at all (missing identifier) if you’ve switched to a different module for the REPL context.