where @ is essentially a “pointer” to an active project. By default it doesn’t point to anything, it exands to nothing
julia> Base.load_path()
2-element Vector{String}:
"/home/fredrik/.julia/environments/v1.6/Project.toml" # expansion of @v#.# in LOAD_PATH
"/opt/julia/julia-1.6.1/share/julia/stdlib/v1.6" # expansion of @stdlib in LOAD_PATH
If you Pkg.activate something you set the pointer to the thing you activated
Thanks magister-ludi. Well I’m not so clear about the analogy with cd. It sounds as if once a project has been activated, the only way to deactivate it is to activate another project. I’m not sure I understand it.
Thanks Fredrik, it’s much clearer now. I was confused when Base.active_project() was not returning a null pointer, but if you say it’s null I’ll take your word for it.
I think the analogy is that in UNIX-like systems, cd without an argument takes you back to a a kind of ‘base state’, which is the home directory. So activate without an argument takes you back to the ‘no specific package loaded’ state.
status remark for v1.7.0:
I found confusing information regarding the environment variable “JULIA_LOAD_PATH”.
On the page about environment variables it is stated:
Unlike the shell PATH variable, empty entries in JULIA_LOAD_PATH are expanded to the default value of LOAD_PATH , ["@", "@v#.#", "@stdlib"] when populating LOAD_PATH . This allows easy appending, prepending, etc. of the load path value in shell scripts regardless of whether JULIA_LOAD_PATH is already set or not. For example, to prepend the directory /foo/bar to LOAD_PATH just do.
But under windows I have the impression that this is not true. Here is what I have added in my startup.jl:
The startup file is executed at start up, I can see the welcome massage that is included.
My expectation was, that modules that are located in this folder will be found,
unfortunately this is not the case.
Yes, this works fine. In fact this is the method I use.
But I wonder, if the information about JULIA_LOAD_PATH is correct.
The following does not work:
to mimic the shell behavior of just inserting an empty string for missing variables. (However, as noted above it is too late to change this once already in Julia.)