The code for Julia packages (also called libraries) is contained in a module whose name starts with an uppercase letter by convention, like this:
# see the code in Chapter 6\modules.jlmodule Package1export Type1, percinclude("file1.jl")include("file2.jl")# codemutable struct Type1 totalendperc(a::Type1) = a.total * 0.01end
This serves to separate all its definitions from those in other modules so that no name conflicts occur. Name conflicts are solved by qualifying the function by the module name. For example, the packages Winston and Gadfly both contain a function plot. If we needed these two versions in the same script, we would write it as follows:
import Winstonimport GadflyWinston.plot(rand(4))Gadfly.plot(x=[1:10], ...