Skip to content

Workflow

It is often useful to try something in a temporary environment.

Pkg.activate(temp = true)

or

pkg> activate --temp

both generate a temporary environment in /tmp and activate it. Here, one can add dependencies and then simply forget the environment once done. The folder will be automatically cleaned up after some time, I believe.

REPL

Useful keyboard shortcuts

  • ^R: search history while showing matching results.
  • help> "abc": search for string "abc" in docstrings.
  • ctrl-left/right: move one word (meta-b/f don't work on mac).
  • ctrl-e: end of line (ctrl-a does not work on mac).

Note: On a mac, Meta is Esc.

Tab completion: can indicate methods that apply. Example from the docs: max([1,2], <TAB>).

Revise.jl

Revise is essential for a smooth workflow.

One limitation: includeing files in a model that is tracked with includet does not work (1.6). Example:

# Foo.jl
module Foo
    include("foo2.jl")
end

# foo2.jl
foo() = println("This is foo")

# REPL
includet("Foo.jl")

produces a MethodError that is hard to make sense of.

Once code gets complicated enough that files include other files, it is best to make a package.