How does environment stacking work?

> Julia environments are stacked.

So just to be sure I understand this: If I activate X then I can using anything that’s added or deved in not just X but also anything that’s in the load path (so by default, anything up the directory hierarchy, for example)?

If that’s right then what happens when I julia --project=@. or julia --project=.

Not sure if this answers your question:

julia> Base.LOAD_PATH
3-element Vector{String}:

As @fbanning showed, the standard LOAD_PATH has three values. @stdlib is the standard library, @v#.# is the base environment of your Julia version (v1.6 for Julia 1.6 for instance, where added packages live that weren’t added in an activated environment) and @ refers to the currently activated environment if there is any. So when you call import or using, Julia goes through those sources in order to find the package to load, starting with a possibly activated local environment, then checking the base environment, and finally checking the standard library (unless you manually modify LOAD_PATH, making it possible to add even more places to check).

When you start Julia as you wrote, you simply bind the @ entry to the activated environment. Julia will still search the base environment and the standard lib if you try using something that’s not in that environment.

It’s pretty simple when you think about it.