Skip to content

Conversation

digital-carver
Copy link

This PR:

  • Adds a Project.toml makes it easier to run the make.jl locally without manually setting up the environment.
  • Avoids using a new Julia process for every script, by instead using include to run them.
  • Uses PyPlot's clf clear figure feature to make sure the plots remain independent of each other
  • Avoids global scope in the code snippets by using let blocks
    • This ensures that the code snippets operate only in their individual local scopes, and don't interfere with each other in any way
    • It also avoids encouraging the use of global scope - a lot of new users to Julia learn coding practices from code samples like this in package docs, and might then fall into the common performance trap of using global scope for everything. Using let blocks like this avoids teaching them this bad practice.

(I left the using PyPlot lines inside the let blocks to avoid changing the code too much, but I can bring those out to be just below the using QuantumOptics lines in each file if that's preferred. It works fine either way, it's just a matter of coding style preference.)

Avoids using a new Julia process for every script.
The Project.toml makes it easier to run the make.jl locally without manually setting up the environment.
Avoids unwanted interactions between different code snippets, and
avoids encouraging writing code in global scope which would be a
bad Julia practice.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant