I’m working with Juno 0.3.0, and my question is on knowing which module we are currently working in.
Starting up the REPL in Juno sets me in the “Main” module, and my current version of Julia (1.2)
Now when I generate a new package called Example, here is what happens:
- before activating the Example environment, I am still in the Main one, which is as expected.
- after activating the Example environment
In all of these screenshots, my cursor was at the end of line 3 of example.jl
This has some importance as when I set my cursor in the REPL, Juno says I am always working the Main module, independently of the activated environment:
What I was expecting after activating the Example environment: see “Example” written at the bottom right corner of Juno, and not Main/Example. About Juno always showing that we are in the Main environment when my cursor in the REPL, I am also unsure about why this is the case.
This might have to do with the following question: can we leave the “Main” module?
Also, I might use “environment” and “module” words inappropriately!
Thanks for any help!
You’re confusing modules and environments.
The module Juno displays dictates where your code is evaluated. If it’s e.g. set to
Base then you have unqualified access to
Bases internals and can overwrite bindings at will. This is very powerful because you don’t need to reload your module for every little edit and can instead make incremental changes.
Environments on the other hand change what packages are loaded (or even available): If you
pkg> activate Example, like in your screenshots, then all package operations will modify that local environment and you will only be able to load packages that are defined as dependencies to
The little indicator in the lower right corner only cares about the former – try browsing through some code in Base or in a stdlib or in your favourite package and observe how it changes (the fact that we’re detecting
Main/Example instead of
Example in your case is kinda unfortunate and should be fixed). You can change what module Juno is evaluating into by either clicking the module indicator or using the
Julia Client: Set Working Module command in the command pane. The REPL is set to
Main by default, but
Follow Editor is also very useful.
Thank your for your answer! Indeed, I am confusing both
So being “current working module” is a possible status for a module and being “current environment” is a possible status for a package right?
In fact in the bottom right corner “Main/Example” appears when I’m on the Example.jl file, but “Example” appears when I’m on another file .jl in Example/src. So apart from when I am on Example.jl, it makes sense.